mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-16 18:15:13 -05:00
refactor: improved readability
This commit is contained in:
parent
14b62b909a
commit
26eee6ca61
1 changed files with 92 additions and 96 deletions
|
@ -21,24 +21,6 @@
|
||||||
(builtins.genList (i: i) numOptions)
|
(builtins.genList (i: i) numOptions)
|
||||||
);
|
);
|
||||||
in let
|
in let
|
||||||
peopleSubmodule = lib.types.submodule {
|
|
||||||
options =
|
|
||||||
builtins.listToAttrs (
|
|
||||||
map (name: {
|
|
||||||
inherit name;
|
|
||||||
value = stringType;
|
|
||||||
})
|
|
||||||
[
|
|
||||||
"user0"
|
|
||||||
"user1"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
// {
|
|
||||||
users = lib.mkOption {
|
|
||||||
type = lib.types.attrsOf userSubmodule;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
userSubmodule = lib.types.submodule {
|
userSubmodule = lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
name = stringType;
|
name = stringType;
|
||||||
|
@ -49,7 +31,47 @@ in let
|
||||||
paths = genOptions stringType "path";
|
paths = genOptions stringType "path";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
serviceSubmodule = lib.types.submodule {
|
instanceSubmodule = lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
subdomain = stringType;
|
||||||
|
label = stringType;
|
||||||
|
name = stringType;
|
||||||
|
domains = genOptions stringType "url";
|
||||||
|
dns = genOptions stringType "provider";
|
||||||
|
localhost = genOptions stringType "address";
|
||||||
|
email = genOptions stringType "address";
|
||||||
|
sops = genOptions stringType "path";
|
||||||
|
paths = genOptions stringType "path";
|
||||||
|
ports = genOptions intType "port";
|
||||||
|
ssl = {
|
||||||
|
cert = stringType;
|
||||||
|
key = stringType;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
deviceSubmodule = lib.types.submodule {
|
||||||
|
options = let
|
||||||
|
mountConfig = {
|
||||||
|
mount = stringType;
|
||||||
|
device = stringType;
|
||||||
|
options = listType;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
boot = mountConfig;
|
||||||
|
ip = genOptions stringType "address";
|
||||||
|
label = stringType;
|
||||||
|
name = stringType;
|
||||||
|
sync = stringType;
|
||||||
|
}
|
||||||
|
// genOptions mountConfig "folder"
|
||||||
|
// genOptions mountConfig "samba"
|
||||||
|
// genOptions mountConfig "storage";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
services = lib.mkOption {
|
||||||
|
type = lib.types.submodule {
|
||||||
options =
|
options =
|
||||||
builtins.listToAttrs (map (name: {
|
builtins.listToAttrs (map (name: {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
@ -84,25 +106,9 @@ in let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
instanceSubmodule = lib.types.submodule {
|
|
||||||
options = {
|
|
||||||
subdomain = stringType;
|
|
||||||
label = stringType;
|
|
||||||
name = stringType;
|
|
||||||
domains = genOptions stringType "url";
|
|
||||||
dns = genOptions stringType "provider";
|
|
||||||
localhost = genOptions stringType "address";
|
|
||||||
email = genOptions stringType "address";
|
|
||||||
sops = genOptions stringType "path";
|
|
||||||
paths = genOptions stringType "path";
|
|
||||||
ports = genOptions intType "port";
|
|
||||||
ssl = {
|
|
||||||
cert = stringType;
|
|
||||||
key = stringType;
|
|
||||||
};
|
};
|
||||||
};
|
machines = lib.mkOption {
|
||||||
};
|
type = lib.types.submodule {
|
||||||
machineSubmodule = lib.types.submodule {
|
|
||||||
options =
|
options =
|
||||||
builtins.listToAttrs (map (name: {
|
builtins.listToAttrs (map (name: {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
@ -124,36 +130,26 @@ in let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
deviceSubmodule = let
|
|
||||||
mountConfig = {
|
|
||||||
mount = stringType;
|
|
||||||
device = stringType;
|
|
||||||
options = listType;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
lib.types.submodule {
|
|
||||||
options =
|
|
||||||
{
|
|
||||||
boot = mountConfig;
|
|
||||||
ip = genOptions stringType "address";
|
|
||||||
label = stringType;
|
|
||||||
name = stringType;
|
|
||||||
sync = stringType;
|
|
||||||
}
|
|
||||||
// genOptions mountConfig "folder"
|
|
||||||
// genOptions mountConfig "samba"
|
|
||||||
// genOptions mountConfig "storage";
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
options = {
|
|
||||||
services = lib.mkOption {
|
|
||||||
type = serviceSubmodule;
|
|
||||||
};
|
|
||||||
machines = lib.mkOption {
|
|
||||||
type = machineSubmodule;
|
|
||||||
};
|
};
|
||||||
people = lib.mkOption {
|
people = lib.mkOption {
|
||||||
type = peopleSubmodule;
|
type = lib.types.submodule {
|
||||||
|
options =
|
||||||
|
builtins.listToAttrs (
|
||||||
|
map (name: {
|
||||||
|
inherit name;
|
||||||
|
value = stringType;
|
||||||
|
})
|
||||||
|
[
|
||||||
|
"user0"
|
||||||
|
"user1"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
// {
|
||||||
|
users = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf userSubmodule;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue