nix-community.nixvim/wrappers/nixos.nix

43 lines
926 B
Nix
Raw Normal View History

modules: {
pkgs,
config,
lib,
...
} @ args: let
2023-08-14 19:48:19 +02:00
inherit (lib) mkEnableOption mkOption mkOptionType mkForce mkMerge mkIf types;
shared = import ./_shared.nix modules args;
cfg = config.programs.nixvim;
files =
shared.configFiles
// {
"nvim/sysinit.lua".text = cfg.initContent;
};
in {
options = {
programs.nixvim = mkOption {
default = {};
type = types.submodule ([
{
options.enable = mkEnableOption "nixvim";
2023-08-14 19:48:19 +02:00
config.wrapRc = mkForce true;
}
]
++ shared.topLevelModules);
};
nixvim.helpers = shared.helpers;
};
config =
mkIf cfg.enable
(mkMerge [
{environment.systemPackages = [cfg.finalPackage];}
(mkIf (!cfg.wrapRc) {
environment.etc = files;
environment.variables."VIM" = "/etc/nvim";
})
{
2023-05-22 15:45:47 +05:30
inherit (cfg) warnings assertions;
}
]);
}