mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-16 10:05:13 -05:00
feat: refactored abstractions
This commit is contained in:
parent
f3897c1e0c
commit
2e0ba5f89e
23 changed files with 324 additions and 310 deletions
|
@ -4,17 +4,21 @@
|
|||
...
|
||||
}: let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.people.user.${user0}) domain email dns;
|
||||
inherit (flake.config.service.instance.acme) paths;
|
||||
inherit (flake.config.people.user.${user0}) email;
|
||||
inherit (flake.config.service) instance;
|
||||
dnsConfig = {
|
||||
dnsProvider = dns.provider0;
|
||||
directory = paths.path0;
|
||||
environmentFile = config.sops.secrets."dns/namecheap".path;
|
||||
};
|
||||
|
||||
domain0 = instance.web.domains.url0;
|
||||
domain1 = instance.web.domains.url1;
|
||||
dns = instance.web.dns.provider0;
|
||||
|
||||
instanceName = service: (instance.${service}.subdomain);
|
||||
|
||||
dnsConfig = {
|
||||
dnsProvider = dns;
|
||||
directory = instance.acme.paths.path0;
|
||||
environmentFile = config.sops.secrets."dns/namecheap".path;
|
||||
};
|
||||
|
||||
domain0SubdomainNames = [
|
||||
"nextcloud"
|
||||
"jellyfin"
|
||||
|
@ -35,13 +39,13 @@
|
|||
"writefreely"
|
||||
];
|
||||
|
||||
domainRoot = [
|
||||
domain0
|
||||
domain1
|
||||
];
|
||||
|
||||
domain0Subdomains = map instanceName domain0SubdomainNames;
|
||||
domain1Subdomains = map instanceName domain1SubdomainNames;
|
||||
|
||||
domainRoot = [
|
||||
domain.url0
|
||||
domain.url1
|
||||
];
|
||||
in {
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
|
@ -51,12 +55,12 @@ in {
|
|||
};
|
||||
certs = builtins.listToAttrs (
|
||||
(map (prefix: {
|
||||
name = "${prefix}.${domain.url0}";
|
||||
name = "${prefix}.${domain0}";
|
||||
value = dnsConfig;
|
||||
})
|
||||
domain0Subdomains)
|
||||
++ (map (prefix: {
|
||||
name = "${prefix}.${domain.url1}";
|
||||
name = "${prefix}.${domain1}";
|
||||
value = dnsConfig;
|
||||
})
|
||||
domain1Subdomains)
|
||||
|
@ -71,7 +75,7 @@ in {
|
|||
sops = let
|
||||
sopsSecrets = ["pass"];
|
||||
sopsPath = secret: {
|
||||
path = "/var/lib/secrets/${instance.acme.name}/${dns.provider0}-${secret}";
|
||||
path = "/var/lib/secrets/${instance.acme.name}/${dns}-${secret}";
|
||||
owner = "root";
|
||||
mode = "600";
|
||||
};
|
||||
|
@ -79,7 +83,7 @@ in {
|
|||
secrets = builtins.listToAttrs (
|
||||
map
|
||||
(secret: {
|
||||
name = "dns/${dns.provider0}";
|
||||
name = "dns/${dns}";
|
||||
value = sopsPath secret;
|
||||
})
|
||||
sopsSecrets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue