From 508aee982ae2fda532742dffdc781f78351e115f Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Wed, 17 Aug 2022 17:48:15 +0300 Subject: 2022-08-17 --- modules/nixfiles/common/nix.nix | 24 ++-- modules/nixfiles/emacs/default.nix | 137 +++++++++++------- modules/nixfiles/emacs/doom/config.el | 31 ++-- modules/nixfiles/emacs/doom/init.el | 236 +++++++++++++++---------------- modules/nixfiles/emacs/doom/packages.el | 4 - modules/nixfiles/games/lutris.nix | 3 + modules/nixfiles/profiles/dev/common.nix | 31 +--- modules/nixfiles/profiles/headful.nix | 12 +- 8 files changed, 240 insertions(+), 238 deletions(-) (limited to 'modules') diff --git a/modules/nixfiles/common/nix.nix b/modules/nixfiles/common/nix.nix index 586f354..5cb77e9 100644 --- a/modules/nixfiles/common/nix.nix +++ b/modules/nixfiles/common/nix.nix @@ -3,7 +3,7 @@ inputs, lib, pkgs, - pkgsRev, + pkgsPR, this, ... }: @@ -78,6 +78,13 @@ in { self.overlays.default (_: super: { + # Splitting this into a separate package could be a good PR. + logcli = super.grafana-loki.overrideAttrs (_: _: { + subPackages = ["cmd/logcli"]; + preFixup = ""; + doCheck = false; + }); + nix-bash-completions = super.nix-bash-completions.overrideAttrs (_: _: { @@ -85,20 +92,16 @@ in { substituteInPlace _nix --replace 'nix nixos-option' 'nixos-option' ''; }); - nix-index = super.nix-index.override {nix = config.nix.package;}; - logcli = super.grafana-loki.overrideAttrs (_: _: { - subPackages = ["cmd/logcli"]; - preFixup = ""; - doCheck = false; - }); + helm = super.kubernetes-helm-wrapped.override { plugins = with super.kubernetes-helmPlugins; [ helm-diff helm-secrets ]; }; - # https://github.com/NixOS/nixpkgs/pull/185824 - inherit (pkgsRev "c9c10940da779db387b8d6326c8c0bee598a0a87" "sha256-r08/Z8EYTNyyZW6lYQyq521OpgUH6ewZPpvDAiCkQaA=") iosevka; + + # https://github.com/NixOS/nixpkgs/pull/187039 + inherit (pkgsPR "187039" "sha256-xyYK1M1FF8e9UDziyqTiWe3XRkRVNdWUyzqG1/Rjry8=") biber; } // (with super; let np = nodePackages; @@ -112,13 +115,14 @@ in { k3d = kube3d; lua-language-server = sumneko-lua-language-server; nix-language-server = rnix-lsp; + omnisharp = omnisharp-roslyn; telepresence = telepresence2; tor-browser = tor-browser-bundle-bin; })) agenix.overlay emacs-overlay.overlay nur.overlay - xmonad-ng.overlay + xmonad-ng.overlays.default ]; config.allowUnfree = true; diff --git a/modules/nixfiles/emacs/default.nix b/modules/nixfiles/emacs/default.nix index 3ebab5f..178bf6e 100644 --- a/modules/nixfiles/emacs/default.nix +++ b/modules/nixfiles/emacs/default.nix @@ -11,63 +11,98 @@ in { options.nixfiles.modules.emacs.enable = mkEnableOption "Whether to enable the GNU Emacs."; - # TODO Nixify. config = mkIf cfg.enable { + # TODO Make magit-forge to work with this. + secrets.authinfo = { + file = "${inputs.self}/secrets/authinfo"; + path = "${config.my.home}/.authinfo"; + owner = my.username; + inherit (config.my) group; + }; + + nixfiles.modules = { + git.enable = true; + gnupg.enable = true; + }; + hm = { - imports = [ - inputs.nix-doom-emacs.hmModule - ]; + imports = [inputs.nix-doom-emacs.hmModule]; - home = { - packages = with pkgs; [ - cmigemo # :lang japanese - gcc # :lang (org +roam2) - gnuplot # :lang (org +gnuplot) - gnutls # :app irc - graphviz # :lang (org +roam2) - grip # :lang (markdown +grip) - maim # :lang (org +dragndrop) - pandoc # :lang org markdown latex - plantuml # :lang plantuml - pre-commit # :tools magit - sqlite # :lang (org +roam2) - texlive.combined.scheme-full # :lang org tex - xclip # :os (tty +osc) + programs.doom-emacs = { + enable = true; + doomPrivateDir = ./doom; + # emacsPackage = pkgs.emacs28.override {nativeComp = true;}; + emacsPackage = pkgs.emacs28; + extraPackages = with pkgs; [ + mu # :email mu4e ]; + extraConfig = let + extraBins = with pkgs; [ + (aspellWithDicts (p: with p; [en ru])) # :checkers spell (+aspell) + asmfmt # :editor format + bash-language-server # :lang (sh +lsp) + clang-tools # :lang (cc +lsp) :editor format + cmake-format # :lang cc :editor format + cmigemo # :lang japanese + dockerfile-language-server # :tools (docker +lsp) + editorconfig # :tools editorconfig + fd # core + gnuplot # :lang (org +gnuplot) + gnutls # core + gomodifytags # :lang go + gopls # :lang (go +lsp) + gore # :lang go + gotests # :lang go + graphviz # :lang (org +roam2) :lang plantuml + grip # :lang (markdown +grip) + haskell-language-server # :lang (haskell +lsp) + haskellPackages.brittany # :lang haskell :editor format + haskellPackages.cabal-fmt # :lang haskell :editor format + haskellPackages.cabal-install # :lang haskell + haskellPackages.hoogle # :lang haskell + html-tidy # :lang web + jdk # :lang java plantuml + lua-language-server # :lang (lua +lsp) + maim # :lang (org +dragndrop) + nix-language-server + nixfmt # :lang nix :editor format + nodePackages.js-beautify # :lang web + nodePackages.lua-fmt # :lang lua :editor format + nodePackages.prettier # :editor format + nodePackages.stylelint # :lang web + pandoc # :lang org markdown latex + pre-commit # :tools magit + python3Packages.black # :lang python :editor format + python3Packages.isort # :lang python + python3Packages.pyflakes # :lang python + ripgrep # core + shellcheck # :lang sh + shfmt # :lang sh :editor format + sqlite # :lang (org +roam2) :tools lookup + texlive.combined.scheme-full # :lang org tex + wordnet # :tools (lookup +dictionary +offline) + yaml-language-server # :lang (yaml +lsp) + zls # :lang (zig +lsp) + ]; + in '' + ;; This will integrate packages, which are required by various modules + ;; without polluting the user's profile. + (setq exec-path (append exec-path '(${ + concatMapStringsSep " " (x: ''"${x}/bin"'') extraBins + }))) + (setenv "PATH" (concat (getenv "PATH") ":${ + concatMapStringsSep ":" (x: "${x}/bin") extraBins + }")) - activation = { - symlinkMigemoFiles = '' - target="${config.dirs.data}/migemo" - [[ -L "$target" ]] && rm "$target" - ln -s ${pkgs.cmigemo}/share/migemo "$target" - ''; - symlinkSkkFiles = '' - target="${config.dirs.data}/skk" - [[ -L "$target" ]] && rm "$target" - ln -s ${pkgs.skk-dicts}/share "$target" - ''; - symlinkPlantumlFiles = '' - target="${config.dirs.data}/plantuml" - [[ -L "$target" ]] && rm "$target" - ln -s ${pkgs.plantuml}/lib "$target" - ''; - }; - }; + ;; :lang plantuml + (setq org-plantuml-jar-path "${pkgs.plantuml}/lib/plantuml.jar") - programs = { - emacs = { - enable = true; - # extraPackages = p: - # with p; [ - # vterm # :term vterm - # ]; - }; + ;; :input japanese + (setq migemo-dictionary "${pkgs.cmigemo}/share/migemo/utf-8/migemo-dict") - doom-emacs = { - enable = true; - doomPrivateDir = ./doom; - emacsPackage = pkgs.emacs28.override {nativeComp = true;}; - }; + ;; :input japanese + (setq skk-large-jisyo "${pkgs.skk-dicts}/share/skk/SKK-JISYO.L") + ''; }; services.emacs = { @@ -75,7 +110,5 @@ in { client.enable = true; }; }; - - fonts.fonts = with pkgs; [emacs-all-the-icons-fonts]; }; } diff --git a/modules/nixfiles/emacs/doom/config.el b/modules/nixfiles/emacs/doom/config.el index d641e2d..b27b7eb 100644 --- a/modules/nixfiles/emacs/doom/config.el +++ b/modules/nixfiles/emacs/doom/config.el @@ -29,12 +29,6 @@ org-roam-ui-update-on-save t org-roam-ui-open-on-start t)) -(setq org-plantuml-jar-path "~/.local/share/plantuml/plantuml.jar") - -(setq migemo-dictionary "~/.local/share/migemo/utf-8/migemo-dict") - -(setq skk-large-jisyo "~/.local/share/skk/SKK-JISYO.L") - (setq lsp-haskell-formatting-provider "brittany") (after! lsp-mode @@ -71,10 +65,6 @@ (setq display-line-numbers-type t) -(when (eq initial-window-system 'x) - (toggle-frame-maximized) - (toggle-frame-fullscreen)) - (setq browse-url-generic-program (executable-find "firefox") browse-url-browser-function 'browse-url-generic) @@ -94,15 +84,6 @@ "a.gondor@yahoo.com")) -(set-email-account! "shire" - '( - (mu4e-drafts-folder . "/shire/Drafts") - (mu4e-refile-folder . "/shire/Archive") - (mu4e-sent-folder . "/shire/Sent") - (mu4e-trash-folder . "/shire/Trash") - (smtpmail-smtp-user . "azahi")) - t) - (set-email-account! "yahoo" '( (mu4e-sent-folder . "/yahoo/Sent") @@ -112,6 +93,15 @@ (smtpmail-smtp-user . "a.gondor")) t) +(set-email-account! "shire" + '( + (mu4e-drafts-folder . "/shire/Drafts") + (mu4e-refile-folder . "/shire/Archive") + (mu4e-sent-folder . "/shire/Sent") + (mu4e-trash-folder . "/shire/Trash") + (smtpmail-smtp-user . "azahi")) + t) + (setq circe-default-nick "azahi" circe-default-realname "frodo@gondor.net" circe-default-user circe-default-nick) @@ -176,8 +166,5 @@ (use-package! kubernetes-tramp :defer t) -(use-package! elpher - :init (setq elpher-default-url-type "gemini")) - (provide 'config) ;;; config.el ends here diff --git a/modules/nixfiles/emacs/doom/init.el b/modules/nixfiles/emacs/doom/init.el index 486010a..91042ea 100644 --- a/modules/nixfiles/emacs/doom/init.el +++ b/modules/nixfiles/emacs/doom/init.el @@ -1,134 +1,130 @@ ;;; init.el -*- lexical-binding: t; -*- -(doom! - :input - japanese +(doom! :input + japanese - :completion - company - vertico + :completion + company + vertico - :ui - deft - doom - ;; doom-dashboard - ;; doom-quit - ;; (emoji +unicode) - hl-todo - hydra - indent-guides - ;; ligatures - ;; (modeline +light) - nav-flash - ophints - (popup +defaults) - ;; tabs - ;; treemacs - unicode - vc-gutter - vi-tilde-fringe - window-select - workspaces - zen + :ui + ;; deft + doom + ;; doom-dashboard + ;; doom-quit + hl-todo + indent-guides + ;; ligatures + ;; (modeline +light) + nav-flash + ophints + (popup +defaults) + ;; tabs + (treemacs +lsp) + ;; unicode + (vc-gutter +diff-hl +pretty) + window-select + workspaces + zen - :editor - (evil +everywhere) - file-templates - fold - (format +onsave) - lispy - multiple-cursors - (objed +manual) - parinfer - rotate-text - snippets - word-wrap + :editor + (evil +everywhere) + file-templates + fold + (format +onsave) + ;; lispy + ;; multiple-cursors + parinfer + ;; rotate-text + snippets + word-wrap - :emacs - dired - electric - ibuffer - (undo +tree) - vc + :emacs + dired + electric + ibuffer + undo + vc - :term - eshell - vterm + :term + eshell + vterm - :checkers - syntax - (spell +flyspell) - grammar + :checkers + syntax + (spell +aspell + +everywhere + +flyspell) + grammar - :tools - ansible - debugger - direnv - (docker +lsp) - editorconfig - (eval +overlay) - (lookup +dictionary +offline) - (lsp +peek) - magit - make - (pass +auth) - pdf - ;; rgb - ;; taskrunner - terraform - tmux - upload + :tools + ansible + (debugger +lsp) + direnv + ;; (docker +lsp) + editorconfig + (eval +overlay) + (lookup +dictionary +offline) + (lsp +peek) + (magit +forge) + make + (pass +auth) + pdf + terraform + ;; tmux + tree-sitter + upload - :os - (tty +osc) + :os + (tty +osc) - :lang - (cc +lsp) - common-lisp - ;; (csharp +lsp) - data - dhall - emacs-lisp - (go +lsp) - (haskell +lsp) - ;; (java +lsp) - ;; (javascript +lsp) - (json +lsp) - (latex +lsp) - ;; (lua +lsp) - markdown - nix - (org - +brain - +dragndrop - +gnuplot - +hugo - +journal - +noter - +pandoc - +pomodoro - +present - +roam2) - plantuml - ;; (php +lsp) - (python +lsp) - (racket +lsp) - ;; (rust +lsp) - (scheme +racket) - (sh +lsp) - web - (yaml +lsp) - (zig +lsp) + :lang + (cc +lsp +tree-sitter) + common-lisp + ;; (csharp +lsp +tree-sitter) + ;; data + dhall + emacs-lisp + (go +lsp +tree-sitter) + ;; (graphql +lsp) + (haskell +lsp) + (java +lsp +tree-sitter) + (javascript +lsp +tree-sitter) + (json +tree-sitter) + (latex +lsp) + (lua +lsp) + markdown + (nix +tree-sitter) + (org +brain + +gnuplot + +hugo + +journal + +noter + +pandoc + +pomodoro + +present + +pretty + +roam2) + plantuml + (python +lsp +tree-sitter) + (racket +lsp) + rst + (rust +lsp) + (scheme +racket) + (sh +lsp +tree-sitter) + (web +lsp +tree-sitter) + (yaml +lsp) + (zig +lsp +tree-sitter) - :email - mu4e + :email + mu4e - :app - calendar - emms - everywhere - irc - (rss +org) + :app + calendar + ;; emms + ;; everywhere + irc + (rss +org) - :config - (default +bindings +smartparens)) + :config + (default +bindings +smartparens)) diff --git a/modules/nixfiles/emacs/doom/packages.el b/modules/nixfiles/emacs/doom/packages.el index 72c3945..b29ee5f 100644 --- a/modules/nixfiles/emacs/doom/packages.el +++ b/modules/nixfiles/emacs/doom/packages.el @@ -6,8 +6,6 @@ (package! kubernetes-evil) (package! kubernetes-tramp) -(package! elpher) - (unpin! org-roam) (package! org-roam :recipe (:host github @@ -19,5 +17,3 @@ :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out"))) - -(package! modus-themes) diff --git a/modules/nixfiles/games/lutris.nix b/modules/nixfiles/games/lutris.nix index ec1eaa2..6d9fdf5 100644 --- a/modules/nixfiles/games/lutris.nix +++ b/modules/nixfiles/games/lutris.nix @@ -16,6 +16,9 @@ in { gamemode.enable = true; }; + # This removes the annoying warning. + boot.kernel.sysctl."dev.i915.perf_stream_paranoid" = 0; + hm.home.packages = with pkgs; [ (lutris.override { lutris-unwrapped = lutris-unwrapped.override { diff --git a/modules/nixfiles/profiles/dev/common.nix b/modules/nixfiles/profiles/dev/common.nix index d6c44ea..e5b60dc 100644 --- a/modules/nixfiles/profiles/dev/common.nix +++ b/modules/nixfiles/profiles/dev/common.nix @@ -46,13 +46,9 @@ in { indent_size = 4 indent_style = tab - [*.{bash,sh}] - indent_size = 4 - indent_style = tab - [*.{cl,clj,el,l,lisp,lsp,rkt,scm,ss}] - indent_size = unset - indent_style = unset + indent_size = 2 + indent_style = space [*.go] indent_size = 4 @@ -255,32 +251,9 @@ in { PYTHONSTARTUP = ./pystartup.py; }; - # TODO Probably should scrap most of these in favor of per-project - # shell.nix or flake.nix. packages = with pkgs; [ - alejandra - bash-language-server - cloc - dockerfile-language-server - editorconfig - fd - fzf htmlq - jc jq - json-language-server - logcli - nix-language-server - nixfmt - nixpkgs-fmt - ripgrep - ripgrep-all - shellcheck - shfmt - treefmt - wrk - yaml-language-server - yamllint yq ]; }; diff --git a/modules/nixfiles/profiles/headful.nix b/modules/nixfiles/profiles/headful.nix index fa2f0d7..e14517e 100644 --- a/modules/nixfiles/profiles/headful.nix +++ b/modules/nixfiles/profiles/headful.nix @@ -24,7 +24,6 @@ in { nixfiles.modules = { alacritty.enable = true; aria2.enable = true; - aspell.enable = true; emacs.enable = true; firefox.enable = true; mpv.enable = true; @@ -40,6 +39,17 @@ in { hm.home.packages = with pkgs; [convmv dos2unix]; + # There are (arguably) not a lot of reasons to keep mitigations enabled not + # on a web facing machine. First of all, to completely mitigate any possible + # Spectre holes one would need to disable Hyperthreading which will + # essentially put one's computer into the stone age by not being able to to + # effectively utilise multi-core systems. Secondly, by enabling mitigations, + # we introduce a plethora of performace overheads[1], which, albeit small, + # but still contribute to overall speed of things. + # + # [1]: https://www.phoronix.com/scan.php?page=article&item=spectre-meltdown-2&num=11 + boot.kernelParams = ["mitigations=off"]; + hardware.opengl = { enable = true; driSupport = true; -- cgit 1.4.1