-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnixosModule.nix
49 lines (48 loc) · 1.17 KB
/
nixosModule.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
{lib, ...}: let
# Note: 'shells' are handled separately
submodules = ["coreUtils"];
###########################
## 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);
options = {
inherit cli;
# Add options to configure and enable the shells
programs = {
zsh.crowConfig = mkEnabled;
bash.crowConfig = mkEnabled;
fish = {
crowConfig = mkEnabled;
};
nushell = {
enable = lib.mkEnableOption "NuShell";
crowConfig = mkEnabled;
};
};
};
#######################
## IMPORT SUBMODULES ##
#######################
imports =
(builtins.map
(u: ./${u}/nixosModule.nix)
submodules)
++ [./shells/nixosModule.nix];
in {
inherit imports;
inherit options;
}