2025-07-07 13:35:12 -05:00
|
|
|
{ flake, ... }:
|
|
|
|
let
|
|
|
|
inherit (flake.config.machines.devices) ceres;
|
|
|
|
inherit (flake.config.services.instances) opencloud web;
|
|
|
|
service = opencloud;
|
|
|
|
localhost = web.localhost.address1;
|
|
|
|
host = service.domains.url0;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
services = {
|
|
|
|
opencloud = {
|
|
|
|
enable = true;
|
|
|
|
url = "https://${host}:${service.ports.port0}";
|
2025-07-07 13:39:57 -05:00
|
|
|
port = builtins.toString service.ports.port0;
|
2025-07-07 13:35:12 -05:00
|
|
|
address = localhost;
|
|
|
|
stateDir = "/var/lib/${service.name}";
|
|
|
|
environment = {
|
|
|
|
OC_INSECURE = "false";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
caddy = {
|
|
|
|
virtualHosts = {
|
|
|
|
"${host}" = {
|
|
|
|
extraConfig = ''
|
|
|
|
reverse_proxy ${localhost}:${toString service.ports.port0}
|
|
|
|
|
|
|
|
tls ${service.ssl.cert} ${service.ssl.key}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
fileSystems."/var/lib/${service.name}" = {
|
|
|
|
device = service.paths.path0;
|
|
|
|
fsType = "none";
|
|
|
|
options = [
|
|
|
|
"bind"
|
|
|
|
];
|
|
|
|
depends = [
|
|
|
|
ceres.storage0.mount
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
|
|
|
|
# "Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
|
|
|
|
];
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
firewall = {
|
|
|
|
allowedTCPPorts = [
|
|
|
|
service.ports.port0
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|