feat: started working on eris

This commit is contained in:
Nick 2025-11-01 03:23:56 -05:00
parent e6b2719034
commit d77ed19d58

View file

@ -1,30 +1,48 @@
{ config, flake, ... }: {
config,
flake,
pkgs,
...
}:
let let
inherit (flake.config.services.instances) opencloud web caddy; inherit (flake.config.services.instances) opencloud web caddy;
inherit (flake.config.machines.devices) eris;
service = opencloud; service = opencloud;
localhost = web.localhost.address1; localhost = web.localhost.address1;
host = service.domains.url0; host = service.domains.url0;
in in
{ {
environment.systemPackages = with pkgs; [
inotify-tools
];
services = { services = {
opencloud = { opencloud = {
enable = true; enable = true;
url = "http://${localhost}:${toString service.ports.port0}"; url = "https://${host}";
port = service.ports.port0; port = service.ports.port0;
address = localhost; address = localhost;
stateDir = "/var/lib/${service.name}"; stateDir = "/var/lib/${service.name}";
environmentFile = config.sops.secrets."${service.name}/env".path; environmentFile = config.sops.secrets."${service.name}/env".path;
}; };
caddy = { caddy = {
virtualHosts = { virtualHosts = {
":${toString caddy.ports.port4}" = { ":${host}" = {
extraConfig = '' extraConfig = ''
reverse_proxy http://${localhost}:${toString service.ports.port0} redir /.well-known/carddav /remote.php/dav/ 301
redir /.well-known/caldav /remote.php/dav/ 301
reverse_proxy ${localhost}:${toString service.ports.port0}
tls ${service.ssl.cert} ${service.ssl.key}
''; '';
}; };
}; };
}; };
}; };
sops = sops =
let let
sopsPath = secret: { sopsPath = secret: {
@ -46,12 +64,22 @@ in
); );
}; };
systemd = { fileSystems."/var/lib/${service.name}" = {
tmpfiles.rules = [ device = service.paths.path0;
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -" fsType = "none";
options = [
"bind"
];
depends = [
eris.storage0.mount
]; ];
}; };
systemd.tmpfiles.rules = [
"Z ${service.paths.path0} 755 ${service.name} ${service.name} -"
"Z ${service.sops.path0} 755 ${service.name} ${service.name} -"
];
networking = { networking = {
firewall = { firewall = {
allowedTCPPorts = [ allowedTCPPorts = [