forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hm.nix
63 lines (61 loc) · 1.29 KB
/
hm.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
self:
{
pkgs,
config,
lib,
...
}@args:
let
inherit (lib)
mkEnableOption
mkOption
mkOptionType
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;
hmConfig = config;
};
modules = [
./modules/hm.nix
../modules/top-level
];
};
};
};
imports = [
(import ./_shared.nix {
filesOpt = [
"xdg"
"configFile"
];
})
];
config = mkIf cfg.enable (mkMerge [
{
home.packages = [
cfg.finalPackage
cfg.printInitPackage
] ++ (lib.optional cfg.enableMan self.packages.${pkgs.stdenv.hostPlatform.system}.man-docs);
}
{
inherit (cfg) warnings assertions;
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; };
}
{
programs.bash.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
programs.fish.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
programs.zsh.shellAliases = mkIf cfg.vimdiffAlias { vimdiff = "nvim -d"; };
}
]);
}