mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
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:
parent
a8f678da24
commit
fb7cda2868
6 changed files with 32 additions and 31 deletions
|
@ -46,8 +46,14 @@ in
|
||||||
|
|
||||||
wrapRc = mkOption {
|
wrapRc = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Should the config be included in the wrapper script.";
|
description = ''
|
||||||
default = false;
|
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 {
|
finalPackage = mkOption {
|
||||||
|
@ -284,20 +290,24 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfigLuaPre = lib.mkOrder 100 (
|
# Set `wrapRc`s option default with even lower priority than `mkOptionDefault`
|
||||||
# Add a global table at start of init
|
wrapRc = lib.mkOverride 1501 true;
|
||||||
''
|
|
||||||
-- Nixvim's internal module table
|
|
||||||
-- Can be used to share code throughout init.lua
|
|
||||||
local _M = {}
|
|
||||||
''
|
|
||||||
+ lib.optionalString config.wrapRc ''
|
|
||||||
|
|
||||||
|
extraConfigLuaPre = lib.mkOrder 100 (
|
||||||
|
lib.concatStringsSep "\n" (
|
||||||
|
lib.optional config.wrapRc ''
|
||||||
-- Ignore the user lua configuration
|
-- Ignore the user lua configuration
|
||||||
vim.opt.runtimepath:remove(vim.fn.stdpath('config')) -- ~/.config/nvim
|
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('config') .. "/after") -- ~/.config/nvim/after
|
||||||
vim.opt.runtimepath:remove(vim.fn.stdpath('data') .. "/site") -- ~/.local/share/nvim/site
|
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 ];
|
extraPlugins = lib.mkIf config.wrapRc [ config.filesPlugin ];
|
||||||
|
|
|
@ -22,6 +22,13 @@ let
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./modules/hm.nix
|
./modules/hm.nix
|
||||||
|
# FIXME: this can't go in ./modules/hm.nix because we eval that module in the docs _without_ nixvim's modules
|
||||||
|
{
|
||||||
|
_file = ./hm.nix;
|
||||||
|
config = {
|
||||||
|
wrapRc = lib.mkOptionDefault false;
|
||||||
|
};
|
||||||
|
}
|
||||||
];
|
];
|
||||||
check = false;
|
check = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
{ lib, ... }:
|
|
||||||
{
|
{
|
||||||
imports = [ ./enable.nix ];
|
imports = [ ./enable.nix ];
|
||||||
|
|
||||||
config = {
|
|
||||||
wrapRc = lib.mkForce true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,4 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
imports = [ ./enable.nix ];
|
imports = [ ./enable.nix ];
|
||||||
|
|
||||||
config = {
|
|
||||||
wrapRc = lib.mkForce true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{ lib, ... }:
|
|
||||||
{
|
|
||||||
config = {
|
|
||||||
wrapRc = lib.mkForce true;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -18,7 +18,6 @@ let
|
||||||
nixvimConfig = evalNixvim {
|
nixvimConfig = evalNixvim {
|
||||||
modules = [
|
modules = [
|
||||||
mod
|
mod
|
||||||
./modules/standalone.nix
|
|
||||||
];
|
];
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
defaultPkgs = pkgs;
|
defaultPkgs = pkgs;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue