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

@ -18,34 +18,6 @@
directory = instance.acme.paths.path0;
environmentFile = config.sops.secrets."dns/namecheap".path;
};
domain0SubdomainNames = [
"nextcloud"
"jellyfin"
"minecraft"
"ollama"
"syncthing"
"vaultwarden"
];
domain1SubdomainNames = [
"wiki"
"nextcloud"
"castopod"
"forgejo"
"matrix"
"owncast"
"peertube"
"writefreely"
];
domainRoot = [
domain0
domain1
];
domain0Subdomains = map instanceName domain0SubdomainNames;
domain1Subdomains = map instanceName domain1SubdomainNames;
in {
security.acme = {
acceptTerms = true;
@ -58,17 +30,38 @@ in {
name = "${prefix}.${domain0}";
value = dnsConfig;
})
domain0Subdomains)
map
instanceName [
"nextcloud"
"jellyfin"
"minecraft"
"ollama"
"syncthing"
"vaultwarden"
])
++ (map (prefix: {
name = "${prefix}.${domain1}";
value = dnsConfig;
})
domain1Subdomains)
map
instanceName [
"wiki"
"nextcloud"
"castopod"
"forgejo"
"matrix"
"owncast"
"peertube"
"writefreely"
])
++ (map (name: {
name = name;
value = dnsConfig;
})
domainRoot)
[
domain0
domain1
])
);
};

View file

@ -59,7 +59,6 @@ in {
};
sops = let
sopsSecrets = ["smtp" "database"];
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
@ -72,7 +71,10 @@ in {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"smtp"
"database"
]
);
};

View file

@ -1,27 +1,27 @@
let
serviceFolders = [
"mastodon"
];
serviceFiles = [
"acme"
"caddy"
"jellyfin"
"logrotate"
"minecraft"
"ollama"
"peertube"
"postgresql"
"owncast"
"samba"
"vaultwarden"
"wiki"
# "forgejo"
# "castopod"
# "nextcloud"
];
in {
{
imports =
(map (folder: ./${folder}) serviceFolders)
++ (map (file: ./${file}.nix) serviceFiles);
(map
(folder: ./${folder})
[
"mastodon"
])
++ (map
(file: ./${file}.nix)
[
"acme"
"caddy"
"jellyfin"
"logrotate"
"minecraft"
"ollama"
"peertube"
"postgresql"
"owncast"
"samba"
"vaultwarden"
"wiki"
# "forgejo"
# "castopod"
# "nextcloud"
]);
}

View file

@ -64,7 +64,6 @@ in {
};
};
sops = let
sopsSecrets = ["smtp" "database"];
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
@ -77,7 +76,10 @@ in {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"smtp"
"database"
]
);
};

View file

@ -146,7 +146,6 @@ in {
systemd.services.caddy.serviceConfig.ReadWriteDirectories = lib.mkForce ["/var/lib/caddy" "/run/mastodon-web"];
sops = let
sopsSecrets = ["smtp" "database" "redis"];
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
@ -159,7 +158,11 @@ in {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"smtp"
"database"
"redis"
]
);
};

View file

@ -50,7 +50,6 @@ in {
};
};
sops = let
sopsSecrets = ["pass"];
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
@ -63,7 +62,9 @@ in {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"pass"
]
);
};

View file

@ -75,7 +75,6 @@ in {
};
sops = let
sopsSecrets = ["pass"];
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
@ -88,7 +87,9 @@ in {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"pass"
]
);
};

View file

@ -81,7 +81,6 @@ in {
};
sops = let
sopsSecrets = ["smtp" "database" "redis" "root" "secret"];
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}-pass";
owner = service.name;
@ -94,7 +93,13 @@ in {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"smtp"
"database"
"redis"
"root"
"secret"
]
);
};

View file

@ -61,7 +61,6 @@ in {
};
sops = let
sopsSecrets = ["env"];
sopsPath = secret: {
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
@ -74,7 +73,9 @@ in {
name = "${service.name}/${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"env"
]
);
};

View file

@ -49,7 +49,6 @@ in {
};
sops = let
sopsSecrets = ["pass" "ssh"];
sopsPath = secret: {
path = "${service.sops.path0}/${secret}";
owner = "root";
@ -62,7 +61,10 @@ in {
name = "${service.name}/${secret}";
value = sopsPath secret;
})
sopsSecrets
[
"pass"
"ssh"
]
);
};