mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-06-16 18:15:13 -05:00
feat: refactored abstractions
This commit is contained in:
parent
f3897c1e0c
commit
2e0ba5f89e
23 changed files with 324 additions and 310 deletions
|
@ -5,11 +5,12 @@
|
|||
...
|
||||
}: let
|
||||
inherit (flake.config.people) user0;
|
||||
inherit (flake.config.people.user.${user0}) domain name;
|
||||
inherit (flake.config.system.device) server wildcard;
|
||||
inherit (flake.config.service.instance) nextcloud nginx;
|
||||
localhost = wildcard.ip.address0;
|
||||
host = "${nextcloud.subdomain}.${domain.url1}";
|
||||
inherit (flake.config.people.user.${user0}) name;
|
||||
inherit (flake.config.system.device) server;
|
||||
inherit (flake.config.service.instance) nextcloud nginx web;
|
||||
service = nextcloud;
|
||||
localhost = web.localhost.address0;
|
||||
host = "${service.subdomain}.${web.domains.url1}";
|
||||
in {
|
||||
services = {
|
||||
nextcloud = {
|
||||
|
@ -24,13 +25,13 @@ in {
|
|||
extraAppsEnable = true;
|
||||
extraApps = {
|
||||
inherit
|
||||
(config.services.nextcloud.package.packages.apps)
|
||||
(config.services.service.package.packages.apps)
|
||||
contacts
|
||||
calendar
|
||||
;
|
||||
};
|
||||
config = {
|
||||
adminpassFile = config.sops.secrets."${nextcloud.name}-pass".path;
|
||||
adminpassFile = config.sops.secrets."${service.name}-pass".path;
|
||||
adminuser = name;
|
||||
dbtype = "pgsql";
|
||||
};
|
||||
|
@ -54,7 +55,7 @@ in {
|
|||
enable = true;
|
||||
virtualHosts.${host}.listen = [
|
||||
{
|
||||
addr = wildcard.ip.address1;
|
||||
addr = web.localhost.address1;
|
||||
port = nginx.ports.port0;
|
||||
}
|
||||
];
|
||||
|
@ -66,7 +67,7 @@ in {
|
|||
extraConfig = ''
|
||||
reverse_proxy ${localhost}:${toString nginx.ports.port0}
|
||||
|
||||
tls ${nextcloud.ssl.cert} ${nextcloud.ssl.key}
|
||||
tls ${service.ssl.cert} ${service.ssl.key}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -76,40 +77,40 @@ in {
|
|||
sops = let
|
||||
sopsSecrets = ["pass"];
|
||||
sopsPath = secret: {
|
||||
path = "${nextcloud.sops.path0}/${nextcloud.name}-${secret}";
|
||||
owner = nextcloud.name;
|
||||
path = "${service.sops.path0}/${service.name}-${secret}";
|
||||
owner = service.name;
|
||||
mode = "600";
|
||||
};
|
||||
in {
|
||||
secrets = builtins.listToAttrs (
|
||||
map
|
||||
(secret: {
|
||||
name = "${nextcloud.name}-${secret}";
|
||||
name = "${service.name}-${secret}";
|
||||
value = sopsPath secret;
|
||||
})
|
||||
sopsSecrets
|
||||
);
|
||||
};
|
||||
|
||||
# fileSystems."/var/lib/${nextcloud.name}" = {
|
||||
# device = nextcloud.paths.path0;
|
||||
# fsType = "none";
|
||||
# options = ["bind"];
|
||||
# depends = [server.storage0.mount];
|
||||
# };
|
||||
fileSystems."/var/lib/${service.name}" = {
|
||||
device = service.paths.path0;
|
||||
fsType = "none";
|
||||
options = ["bind"];
|
||||
depends = [server.storage0.mount];
|
||||
};
|
||||
|
||||
# systemd.tmpfiles.rules = [
|
||||
# "Z ${nextcloud.paths.path0} 750 ${nextcloud.name} ${nextcloud.name} -"
|
||||
# "Z ${nextcloud.sops.path0} 750 ${nextcloud.name} ${nextcloud.name} -"
|
||||
# ];
|
||||
systemd.tmpfiles.rules = [
|
||||
"Z ${service.paths.path0} 750 ${service.name} ${service.name} -"
|
||||
"Z ${service.sops.path0} 750 ${service.name} ${service.name} -"
|
||||
];
|
||||
|
||||
users.users.${nextcloud.name}.extraGroups = ["caddy" "nginx" "postgres"];
|
||||
users.users.${service.name}.extraGroups = ["caddy" "nginx" "postgres"];
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedTCPPorts = [
|
||||
nginx.ports.port0
|
||||
nextcloud.ports.port0
|
||||
service.ports.port0
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue