From b280bf2b6ee856b524550dc5ec748272eb340303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Wed, 23 Mar 2022 12:41:04 +0100 Subject: [PATCH] :rocket: add editors module --- modules/editors/code.nix | 25 +++++++ modules/editors/default.nix | 27 +++++++- modules/editors/emacs.nix | 129 ++++++++++++++++++------------------ modules/editors/idea.nix | 9 ++- modules/editors/vim.nix | 13 ++-- modules/editors/vscode.nix | 22 ------ 6 files changed, 130 insertions(+), 95 deletions(-) create mode 100644 modules/editors/code.nix delete mode 100644 modules/editors/vscode.nix diff --git a/modules/editors/code.nix b/modules/editors/code.nix new file mode 100644 index 0000000..3eb00e6 --- /dev/null +++ b/modules/editors/code.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +let cfg = config.modules.editors; +in { + config = lib.mkIf cfg.code { + home-manager.users.moritz = { + programs.vscode = { + enable = true; + package = pkgs.vscode-fhsWithPackages (ps: with ps; [ git ]); + extensions = with pkgs.vscode-extensions; + [ + vscodevim.vim + dracula-theme.theme-dracula + esbenp.prettier-vscode + pkief.material-icon-theme + ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [{ + name = "copilot"; + publisher = "GitHub"; + version = "1.7.3689"; + sha256 = "16zrrymxfymc0039zf48vm22rxjs22mh9zkvkpg45grx2a2m19zh"; + }]; + }; + }; + }; +} diff --git a/modules/editors/default.nix b/modules/editors/default.nix index fe882ed..b85cb82 100644 --- a/modules/editors/default.nix +++ b/modules/editors/default.nix @@ -1,5 +1,28 @@ { config, lib, pkgs, ... }: -{ - imports = [ ./emacs.nix ./idea.nix ./vim.nix ./vscode.nix ]; +with lib; { + imports = [ ./emacs.nix ./idea.nix ./vim.nix ./code.nix ]; + + options.modules.editors = { + emacs = mkOption { + default = true; + type = types.bool; + example = false; + }; + idea = mkOption { + default = false; + type = types.bool; + example = true; + }; + vim = mkOption { + default = true; + type = types.bool; + example = false; + }; + code = mkOption { + default = false; + type = types.bool; + example = true; + }; + }; } diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 24058e2..d69cb40 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -4,71 +4,74 @@ let emacs = with pkgs; ((emacsPackagesFor emacsGcc).emacsWithPackages (epkgs: [ epkgs.vterm epkgs.emacsql-sqlite3 ])); + cfg = config.modules.editors; in { - fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ]; + config = lib.mkIf cfg.emacs { + fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ]; - home-manager.users.moritz = { - home.sessionPath = [ "/home/moritz/.config/emacs/bin/" ]; - services.emacs = { - enable = true; - package = emacs; + home-manager.users.moritz = { + home.sessionPath = [ "/home/moritz/.config/emacs/bin/" ]; + services.emacs = { + enable = true; + package = emacs; + }; + + home.packages = with pkgs; [ + ## Emacs itself + binutils # native-comp needs 'as', provided by this + emacs + + ## Doom dependencies + git + (ripgrep.override { withPCRE2 = true; }) + gnutls # for TLS connectivity + + ## Optional dependencies + fd # faster projectile indexing + imagemagick # for image-dired + zstd # for undo-fu-session/undo-tree compression + + ## Module dependencies + # :checkers spell + # (aspellWithDicts (ds: with ds; [ en en-computers en-science de ])) + hunspell + hunspellDicts.en_GB-ize + hunspellDicts.en_US + hunspellDicts.de_DE + + # :checkers grammar + languagetool + + # :tools lookup & :lang org +roam + sqlite + wordnet + graphviz + + # :lang latex & :lang org (latex previews) + texlive.combined.scheme-full + texlab + + # :lang nix + nixfmt # for formating nix + rnix-lsp + + # :lang markdown + pandoc + + # :app everywhere + xdotool + xorg.xwininfo + xclip + xorg.xprop + + # :lang python + nodePackages.pyright + python-dev + + # :email + mu + isync + ]; }; - - home.packages = with pkgs; [ - ## Emacs itself - binutils # native-comp needs 'as', provided by this - emacs - - ## Doom dependencies - git - (ripgrep.override { withPCRE2 = true; }) - gnutls # for TLS connectivity - - ## Optional dependencies - fd # faster projectile indexing - imagemagick # for image-dired - zstd # for undo-fu-session/undo-tree compression - - ## Module dependencies - # :checkers spell - # (aspellWithDicts (ds: with ds; [ en en-computers en-science de ])) - hunspell - hunspellDicts.en_GB-ize - hunspellDicts.en_US - hunspellDicts.de_DE - - # :checkers grammar - languagetool - - # :tools lookup & :lang org +roam - sqlite - wordnet - graphviz - - # :lang latex & :lang org (latex previews) - texlive.combined.scheme-full - texlab - - # :lang nix - nixfmt # for formating nix - rnix-lsp - - # :lang markdown - pandoc - - # :app everywhere - xdotool - xorg.xwininfo - xclip - xorg.xprop - - # :lang python - nodePackages.pyright - python-dev - - # :email - mu - isync - ]; }; } diff --git a/modules/editors/idea.nix b/modules/editors/idea.nix index d349a0e..91e301d 100644 --- a/modules/editors/idea.nix +++ b/modules/editors/idea.nix @@ -1,7 +1,10 @@ { config, lib, pkgs, ... }: -{ - home-manager.users.moritz = { - home.packages = with pkgs; [ jdk jetbrains.idea-ultimate ]; +let cfg = config.modules.editors; +in { + config = lib.mkIf cfg.idea { + home-manager.users.moritz = { + home.packages = with pkgs; [ jdk jetbrains.idea-ultimate ]; + }; }; } diff --git a/modules/editors/vim.nix b/modules/editors/vim.nix index 91ab5f2..f92d88f 100644 --- a/modules/editors/vim.nix +++ b/modules/editors/vim.nix @@ -1,9 +1,12 @@ { config, lib, pkgs, ... }: -{ - home-manager.users.moritz.programs.neovim = { - enable = true; - vimAlias = true; - vimdiffAlias = true; +let cfg = config.modules.editors; +in { + config = lib.mkIf cfg.vim { + home-manager.users.moritz.programs.neovim = { + enable = true; + vimAlias = true; + vimdiffAlias = true; + }; }; } diff --git a/modules/editors/vscode.nix b/modules/editors/vscode.nix deleted file mode 100644 index 4228281..0000000 --- a/modules/editors/vscode.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - home-manager.users.moritz = { - programs.vscode = { - enable = true; - package = pkgs.vscode-fhsWithPackages (ps: with ps; [ git ]); - extensions = with pkgs.vscode-extensions; - [ - vscodevim.vim - dracula-theme.theme-dracula - esbenp.prettier-vscode - pkief.material-icon-theme - ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [{ - name = "copilot"; - publisher = "GitHub"; - version = "1.7.3689"; - sha256 = "16zrrymxfymc0039zf48vm22rxjs22mh9zkvkpg45grx2a2m19zh"; - }]; - }; - }; -}