From 11924e15935a359c232cebf7756df1a809f05ae9 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Wed, 25 Sep 2024 17:43:04 +0100 Subject: [PATCH] modules/output: add `impureRtp` option Instead of assuming `wrapRc` implies we don't want impurities, configure this separately. --- modules/top-level/output.nix | 17 +++++++++++++++-- wrappers/hm.nix | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/top-level/output.nix b/modules/top-level/output.nix index 7ec61453..49d27c48 100644 --- a/modules/top-level/output.nix +++ b/modules/top-level/output.nix @@ -56,6 +56,18 @@ in ''; }; + impureRtp = mkOption { + type = types.bool; + description = '' + Whether to keep the (impure) nvim config directory in the runtimepath. + + If disabled, the XDG config dirs `nvim` and `nvim/after` will be removed from the runtimepath. + ''; + defaultText = lib.literalMD '' + Configured by your installation method: `true` when using the home-manager module, `false` otherwise. + ''; + }; + finalPackage = mkOption { type = types.package; description = "Wrapped Neovim."; @@ -290,12 +302,13 @@ in ''; }; - # Set `wrapRc`s option default with even lower priority than `mkOptionDefault` + # Set `wrapRc` and `impureRtp`s option defaults with even lower priority than `mkOptionDefault` wrapRc = lib.mkOverride 1501 true; + impureRtp = lib.mkOverride 1501 false; extraConfigLuaPre = lib.mkOrder 100 ( lib.concatStringsSep "\n" ( - lib.optional config.wrapRc '' + lib.optional (!config.impureRtp) '' -- Ignore the user lua configuration vim.opt.runtimepath:remove(vim.fn.stdpath('config')) -- ~/.config/nvim vim.opt.runtimepath:remove(vim.fn.stdpath('config') .. "/after") -- ~/.config/nvim/after diff --git a/wrappers/hm.nix b/wrappers/hm.nix index a07096f6..b7e05cee 100644 --- a/wrappers/hm.nix +++ b/wrappers/hm.nix @@ -27,6 +27,7 @@ let _file = ./hm.nix; config = { wrapRc = lib.mkOptionDefault false; + impureRtp = lib.mkOptionDefault true; }; } ];