refactor: reworked all maps

This commit is contained in:
Nick 2024-11-04 02:09:15 -06:00
parent b5aa0453e4
commit a114034e0e
20 changed files with 220 additions and 207 deletions

View file

@ -1,41 +1,4 @@
{lib, ...}: let
deviceNames = [
"desktop"
"laptop"
"nas"
"phone"
"printer0"
"printer1"
"server"
"tablet"
];
instanceNames = [
"acme"
"caddy"
"castopod"
"forgejo"
"jellyfin"
"mastodon"
"matrix"
"minecraft"
"nextcloud"
"nginx"
"ollama"
"owncast"
"peertube"
"postgresql"
"samba"
"syncthing"
"synology"
"vaultwarden"
"web"
"wiki"
"writefreely"
];
userNames = [
"user0"
"user1"
];
stringType = lib.mkOption {
type = lib.types.str;
};
@ -60,11 +23,16 @@
in let
peopleSubmodule = lib.types.submodule {
options =
builtins.listToAttrs (map (name: {
builtins.listToAttrs (
map (name: {
inherit name;
value = stringType;
})
userNames)
[
"user0"
"user1"
]
)
// {
user = lib.mkOption {
type = lib.types.attrsOf userSubmodule;
@ -83,14 +51,33 @@ in let
};
serviceSubmodule = lib.types.submodule {
options =
builtins.listToAttrs (
map
(name: {
builtins.listToAttrs (map (name: {
inherit name;
value = stringType;
})
instanceNames
)
[
"acme"
"caddy"
"castopod"
"forgejo"
"jellyfin"
"mastodon"
"matrix"
"minecraft"
"nextcloud"
"nginx"
"ollama"
"owncast"
"peertube"
"postgresql"
"samba"
"syncthing"
"synology"
"vaultwarden"
"web"
"wiki"
"writefreely"
])
// {
instance = lib.mkOption {
type = lib.types.attrsOf instanceSubmodule;
@ -117,14 +104,20 @@ in let
};
systemSubmodule = lib.types.submodule {
options =
builtins.listToAttrs (
map
(name: {
builtins.listToAttrs (map (name: {
inherit name;
value = stringType;
})
deviceNames
)
[
"desktop"
"laptop"
"nas"
"phone"
"printer0"
"printer1"
"server"
"tablet"
])
// {
device = lib.mkOption {
type = lib.types.attrsOf deviceSubmodule;