forked from ToyVo/nh_plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.nix
40 lines (38 loc) · 1.13 KB
/
module.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
self:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.nh;
in
{
options.programs.nh = {
os.flake = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
The path that will be used for the `NH_OS_FLAKE` environment variable.
`NH_OS_FLAKE` is used by nh as the default flake for performing actions on NixOS/nix-darwin, like `nh os switch`.
'';
};
home.flake = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
The path that will be used for the `NH_HOME_FLAKE` environment variable.
`NH_HOME_FLAKE` is used by nh as the default flake for performing actions on home-manager, like `nh home switch`.
'';
};
};
config = {
nixpkgs.overlays = [ self.overlays.default ];
programs.nh.package = lib.mkDefault self.packages.${pkgs.stdenv.hostPlatform.system}.default;
environment.variables = lib.mkMerge [
(lib.mkIf (cfg.os.flake != null) { NH_OS_FLAKE = cfg.os.flake; })
(lib.mkIf (cfg.home.flake != null) { NH_HOME_FLAKE = cfg.home.flake; })
];
};
}