From 9f7dc70ab8c05bb61a641eb5e149bcbab7f411d7 Mon Sep 17 00:00:00 2001 From: foo-dogsquared Date: Sat, 25 Dec 2021 21:56:50 +0800 Subject: [PATCH] Add `modules.editors` module for home-manager --- modules/home-manager/dev.nix | 1 - modules/home-manager/editors.nix | 57 +++++++++++++++++++ users/home-manager/foo-dogsquared/default.nix | 26 +-------- 3 files changed, 59 insertions(+), 25 deletions(-) create mode 100644 modules/home-manager/editors.nix diff --git a/modules/home-manager/dev.nix b/modules/home-manager/dev.nix index c43ca21c..ff6401a2 100644 --- a/modules/home-manager/dev.nix +++ b/modules/home-manager/dev.nix @@ -11,7 +11,6 @@ in { config = lib.mkIf cfg.enable (lib.mkMerge [ ({ home.packages = with pkgs; [ - neovim # My text editor of choice. lazygit # Git interface for the lazy. fzf # A fuzzy finder that enables fuzzy finding not furry finding, a common misconception. gopass # An improved version of the password manager for hipsters. diff --git a/modules/home-manager/editors.nix b/modules/home-manager/editors.nix new file mode 100644 index 00000000..094eb9ed --- /dev/null +++ b/modules/home-manager/editors.nix @@ -0,0 +1,57 @@ +# My editor configurations. Take note I try to avert as much settings to create +# the configuration files with Nix. I prefer to handle the text editor +# configurations by hand as they are very chaotic and it is a hassle going +# through Nix whenever I need to change it. +# +# As much as I want 100% reproducibility with Nix, 5% of the remaining stuff +# for me is not worth to maintain. +{ config, options, lib, pkgs, ... }: + +let cfg = config.modules.editors; +in { + options.modules.editors = { + neovim.enable = lib.mkEnableOption "foo-dogsquared's Neovim setup with Nix"; + emacs.enable = lib.mkEnableOption "foo-dogsquared's (Doom) Emacs setup"; + }; + + config = lib.mkMerge [ + (lib.mkIf cfg.neovim.enable { + programs.neovim = { + enable = true; + package = pkgs.neovim-nightly; + withPython3 = true; + withRuby = true; + withNodeJs = true; + }; + }) + + (lib.mkIf cfg.emacs.enable { + # Doom Emacs dependencies. + home.packages = with pkgs; [ + emacs + + # Required dependencies. + ripgrep + gnutls + emacs-all-the-icons-fonts + + # Optional dependencies. + fd + imagemagick + zstd + + # Module dependencies. + ## :checkers spell + aspell + aspellDicts.en + aspellDicts.en-computers + + ## :tools lookup + wordnet + + ## :lang org +roam2 + sqlite + ]; + }) + ]; +} diff --git a/users/home-manager/foo-dogsquared/default.nix b/users/home-manager/foo-dogsquared/default.nix index 18d2f9e3..ab66882b 100644 --- a/users/home-manager/foo-dogsquared/default.nix +++ b/users/home-manager/foo-dogsquared/default.nix @@ -6,30 +6,7 @@ emacs github-cli ncmpcpp - ] - # Doom Emacs dependencies. - ++ (with pkgs; [ - ripgrep - gnutls - emacs-all-the-icons-fonts - - # Optional dependencies. - fd - imagemagick - zstd - - # Module dependencies - # :checkers spell - aspell - aspellDicts.en - aspellDicts.en-computers - - # :tools lookup - wordnet - - # :lang org +roam2 - sqlite - ]); + ]; fonts.fontconfig.enable = true; @@ -56,6 +33,7 @@ enable = true; shell.enable = true; }; + editors.emacs.enable = true; desktop = { enable = true; graphics.enable = true;