From fcaed357f4c9b0c91a21149b5b53cc007ec91592 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 1 Aug 2023 17:28:06 +0300 Subject: [PATCH 1/2] feat: customizable neovim package --- modules/basic/config.nix | 2 +- modules/basic/module.nix | 10 +++++++++- modules/default.nix | 16 ++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 6e4237c..9329346 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -138,7 +138,7 @@ in { ${optionalString (!cfg.enableEditorconfig) '' let g:editorconfig = v:false ''} - ${optionalString (cfg.spellChecking.enable) '' + ${optionalString cfg.spellChecking.enable '' set spell set spelllang=${toString cfg.spellChecking.language} ''} diff --git a/modules/basic/module.nix b/modules/basic/module.nix index 3f8e49a..1793607 100644 --- a/modules/basic/module.nix +++ b/modules/basic/module.nix @@ -1,11 +1,19 @@ { + pkgs, lib, - config, ... }: with lib; with builtins; { options.vim = { + package = mkOption { + type = types.package; + default = pkgs.neovim-unwrapped; + description = '' + The neovim package to use. You will need to use an unwrapped package for this option to work as intended. + ''; + }; + debugMode = { enable = mkEnableOption "debug mode"; level = mkOption { diff --git a/modules/default.nix b/modules/default.nix index 1e06398..815055c 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -6,7 +6,7 @@ inputs: { extraSpecialArgs ? {}, }: let inherit (pkgs) neovim-unwrapped wrapNeovim vimPlugins; - inherit (builtins) map filter isString toString getAttr hasAttr attrNames; + inherit (builtins) map filter isString toString getAttr; inherit (pkgs.vimUtils) buildVimPluginFrom2Nix; extendedLib = import ../lib/stdlib-extended.nix lib; @@ -18,11 +18,7 @@ inputs: { module = extendedLib.evalModules { modules = [configuration] ++ nvimModules; - specialArgs = - { - modulesPath = toString ./.; - } - // extraSpecialArgs; + specialArgs = {modulesPath = toString ./.;} // extraSpecialArgs; }; buildPlug = {pname, ...} @ args: @@ -59,9 +55,10 @@ inputs: { (f: f != null) plugins); - neovim = wrapNeovim neovim-unwrapped { - viAlias = vimOptions.viAlias; - vimAlias = vimOptions.vimAlias; + neovim = wrapNeovim vimOptions.package { + inherit (vimOptions) viAlias; + inherit (vimOptions) vimAlias; + configure = { customRC = vimOptions.builtConfigRC; @@ -72,7 +69,6 @@ inputs: { }; }; in { - imports = [./assertions.nix]; inherit (module) options config; inherit (module._module.args) pkgs; inherit neovim; From c9509d5b091770b98af9027df55065b03fb9e174 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 2 Aug 2023 09:53:07 +0300 Subject: [PATCH 2/2] docs: document custom package usage --- docs/manual.xml | 1 + docs/manual/custom-package.adoc | 14 ++++++++++++++ docs/release-notes/rl-0.5.adoc | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 docs/manual/custom-package.adoc diff --git a/docs/manual.xml b/docs/manual.xml index 7184dbb..b16baa1 100644 --- a/docs/manual.xml +++ b/docs/manual.xml @@ -20,6 +20,7 @@ + diff --git a/docs/manual/custom-package.adoc b/docs/manual/custom-package.adoc new file mode 100644 index 0000000..64c043c --- /dev/null +++ b/docs/manual/custom-package.adoc @@ -0,0 +1,14 @@ +[[ch-custom-package]] +== Custom Neovim Package + +As of v0.5, you may now specify the neovim package that will be wrapped with your configuration. This is done with the `vim.package` option. + +[source,nix] +---- +{inputs, pkgs, ...}: { + # using the neovim-nightly overlay + config.vim.package = inputs.neovim-overlay.packages.${pkgs.system}.neovim; +} +---- + +The neovim-nightly-overlay always exposes an unwrapped package. If using a different source, you are highly recommended to get an "unwrapped" version of the neovim package,similar to `neovim-unwrapped` in nixpkgs. diff --git a/docs/release-notes/rl-0.5.adoc b/docs/release-notes/rl-0.5.adoc index f6416fb..5b45d11 100644 --- a/docs/release-notes/rl-0.5.adoc +++ b/docs/release-notes/rl-0.5.adoc @@ -41,3 +41,5 @@ https://github.com/notashelf[notashelf]: * Added lsp_lines plugin for showing diagnostic messages * Added a configuration option for choosing the leader key + +* The package used for neovim is now customizable by the user, using <>. For best results, always use an unwrapped package.