mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
This commit only adds Home-Manager specific options, we should add sections for the different kind of modules too. This is _not_ added to the man docs, as it is more complex. If need arises we could look into how to do it.
61 lines
1.3 KiB
Nix
61 lines
1.3 KiB
Nix
{
|
|
modules,
|
|
self,
|
|
getHelpers,
|
|
}: {
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
} @ args: let
|
|
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
|
|
helpers = getHelpers pkgs false;
|
|
shared = import ./_shared.nix {inherit modules helpers;} args;
|
|
cfg = config.programs.nixvim;
|
|
files =
|
|
shared.configFiles
|
|
// {
|
|
"nvim/init.lua".text = cfg.initContent;
|
|
};
|
|
in {
|
|
options = {
|
|
programs.nixvim = mkOption {
|
|
default = {};
|
|
type = types.submoduleWith {
|
|
shorthandOnlyDefinesConfig = true;
|
|
specialArgs = {
|
|
hmConfig = config;
|
|
inherit helpers;
|
|
};
|
|
modules =
|
|
[
|
|
(import ./modules/hm.nix {
|
|
inherit lib;
|
|
})
|
|
]
|
|
++ shared.topLevelModules;
|
|
};
|
|
};
|
|
nixvim.helpers = shared.helpers;
|
|
};
|
|
|
|
config =
|
|
mkIf cfg.enable
|
|
(mkMerge [
|
|
{
|
|
home.packages =
|
|
[
|
|
cfg.finalPackage
|
|
cfg.printInitPackage
|
|
]
|
|
++ (lib.optional cfg.enableMan self.packages.${pkgs.system}.man-docs);
|
|
}
|
|
(mkIf (!cfg.wrapRc) {
|
|
xdg.configFile = files;
|
|
})
|
|
{
|
|
inherit (cfg) warnings assertions;
|
|
home.sessionVariables = mkIf cfg.defaultEditor {EDITOR = "nvim";};
|
|
}
|
|
]);
|
|
}
|