forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nixos.nix
64 lines (62 loc) · 1.24 KB
/
nixos.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
self:
{
pkgs,
config,
lib,
...
}@args:
let
inherit (lib)
mkEnableOption
mkOption
mkOptionType
mkForce
mkMerge
mkIf
types
;
cfg = config.programs.nixvim;
in
{
options = {
programs.nixvim = mkOption {
default = { };
type = types.submoduleWith {
shorthandOnlyDefinesConfig = true;
specialArgs = config.lib.nixvim.modules.specialArgsWith {
defaultPkgs = pkgs;
nixosConfig = config;
};
modules = [
./modules/nixos.nix
../modules/top-level
];
};
};
};
imports = [
(import ./_shared.nix {
filesOpt = [
"environment"
"etc"
];
initName = "sysinit.lua";
})
];
config = mkIf cfg.enable (mkMerge [
{
environment.systemPackages = [
cfg.finalPackage
cfg.printInitPackage
] ++ (lib.optional cfg.enableMan self.packages.${pkgs.stdenv.hostPlatform.system}.man-docs);
}
{
inherit (cfg) warnings assertions;
programs.neovim.defaultEditor = cfg.defaultEditor;
environment.variables = {
VIM = mkIf (!cfg.wrapRc) "/etc/nvim";
EDITOR = mkIf cfg.defaultEditor (lib.mkOverride 900 "nvim");
};
}
]);
}