From f02ad7eae620e644fa90c54ed088797affc18fb3 Mon Sep 17 00:00:00 2001 From: chn Date: Sun, 10 Nov 2024 12:15:21 +0800 Subject: [PATCH] modules.packages.vim: restore --- modules/packages/helix.nix | 10 +--------- modules/packages/vim.nix | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 modules/packages/vim.nix diff --git a/modules/packages/helix.nix b/modules/packages/helix.nix index 49b16c84..5e1f69ed 100644 --- a/modules/packages/helix.nix +++ b/modules/packages/helix.nix @@ -15,15 +15,7 @@ inputs: settings.theme = "catppuccin_latte"; }; }]; - packages.packages._packages = - [ - inputs.pkgs.helix - (inputs.pkgs.runCommand "vim" {} - '' - mkdir -p $out/bin - ln -s ${inputs.pkgs.helix}/hx $out/bin/vim - '') - ]; + packages.packages._packages = [ inputs.pkgs.helix ]; }; }; } diff --git a/modules/packages/vim.nix b/modules/packages/vim.nix new file mode 100644 index 00000000..94c808b5 --- /dev/null +++ b/modules/packages/vim.nix @@ -0,0 +1,30 @@ +inputs: +{ + options.nixos.packages.vim = let inherit (inputs.lib) mkOption types; in mkOption + { type = types.nullOr (types.submodule {}); default = {}; }; + config = let inherit (inputs.config.nixos.packages) vim; in inputs.lib.mkIf (vim != null) + { + nixos.user.sharedModules = + [{ + config.programs.vim = + { + enable = true; + defaultEditor = true; + packageConfigurable = inputs.config.programs.vim.package; + settings = + { + number = true; + expandtab = false; + shiftwidth = 2; + tabstop = 2; + }; + extraConfig = + '' + set clipboard=unnamedplus + colorscheme evening + ''; + }; + }]; + programs.vim.package = inputs.pkgs.vim-full; + }; +}