modules/output: refactor wrapRc default

Set default to `true`, with a low priority. Home-manager's wrapper sets
its own default using `mkOptionDefault`.

Clarify using `defaultText`.
This commit is contained in:
Matt Sturgeon 2024-09-25 17:38:23 +01:00
parent a8f678da24
commit fb7cda2868
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
6 changed files with 32 additions and 31 deletions

View file

@ -46,8 +46,14 @@ in
wrapRc = mkOption {
type = types.bool;
description = "Should the config be included in the wrapper script.";
default = false;
description = ''
Whether the config will be included in the wrapper script.
When enabled, the nixvim config will be passed to `nvim` using the `-u` option.
'';
defaultText = lib.literalMD ''
Configured by your installation method: `false` when using the home-manager module, `true` otherwise.
'';
};
finalPackage = mkOption {
@ -284,20 +290,24 @@ in
'';
};
extraConfigLuaPre = lib.mkOrder 100 (
# Add a global table at start of init
''
-- Nixvim's internal module table
-- Can be used to share code throughout init.lua
local _M = {}
''
+ lib.optionalString config.wrapRc ''
# Set `wrapRc`s option default with even lower priority than `mkOptionDefault`
wrapRc = lib.mkOverride 1501 true;
-- 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
vim.opt.runtimepath:remove(vim.fn.stdpath('data') .. "/site") -- ~/.local/share/nvim/site
''
extraConfigLuaPre = lib.mkOrder 100 (
lib.concatStringsSep "\n" (
lib.optional config.wrapRc ''
-- 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
vim.opt.runtimepath:remove(vim.fn.stdpath('data') .. "/site") -- ~/.local/share/nvim/site
''
# Add a global table at start of init
++ lib.singleton ''
-- Nixvim's internal module table
-- Can be used to share code throughout init.lua
local _M = {}
''
)
);
extraPlugins = lib.mkIf config.wrapRc [ config.filesPlugin ];