-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhomeManagerModule.nix
54 lines (49 loc) · 1.25 KB
/
homeManagerModule.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
{lib, ...}: let
# Note: 'shells' are handled separately, as they are not simple CLI programs
submodules = ["coreUtils" "productivity" "media"];
###########################
## CONVENIENCE FUNCTIONS ##
###########################
# Creates a programs.${utility}.enable option that defaults to `true`
mkEnabled = lib.mkOption {
type = lib.types.bool;
default = true;
};
############################################
## GENERATE 'ENABLE' OPTION PER SUBMODULE ##
############################################
cli =
builtins.listToAttrs
(builtins.map (u: {
name = u;
value = {enable = mkEnabled;};
})
submodules);
# Don't repeat the options if the caller is using the combined NixOS + Home Manager Module
options = {
inherit cli;
programs = {
bash.crowConfig = mkEnabled;
zsh = {
crowConfig = mkEnabled;
};
fish = {
crowConfig = mkEnabled;
};
nushell = {
crowConfig = mkEnabled;
};
};
};
#######################
## IMPORT SUBMODULES ##
#######################
imports =
builtins.map
(u: ./${u}/homeManagerModule.nix)
submodules
++ [./shells/homeManagerModule.nix];
in {
inherit imports;
inherit options;
}