dotfiles/modules/nixos/services/podgrab/default.nix

78 lines
1.7 KiB
Nix
Raw Normal View History

{ config, flake, ... }:
let
inherit (flake.config.services.instances) podgrab web;
inherit (flake.config.machines.devices) ceres;
service = podgrab;
localhost = web.localhost.address0;
host = service.domains.url0;
in
{
services = {
podgrab = {
enable = true;
port = service.ports.port0;
2025-06-22 12:33:54 -05:00
passwordFile = config.sops.secrets."${service.name}-pass".path;
dataDirectory = service.paths.path0;
};
caddy = {
virtualHosts = {
"${host}" = {
extraConfig = ''
redir /.well-known/carddav /remote.php/dav/ 301
redir /.well-known/caldav /remote.php/dav/ 301
2025-06-22 11:56:09 -05:00
reverse_proxy ${localhost}:${toString service.ports.port0}
tls ${service.ssl.cert} ${service.ssl.key}
'';
};
};
};
};
sops =
let
sopsPath = secret: {
2025-06-22 12:25:44 -05:00
path = "${service.sops.path0}/${service.name}-${secret}";
owner = service.name;
mode = "600";
};
in
{
secrets = builtins.listToAttrs (
map
(secret: {
name = "${service.name}-${secret}";
value = sopsPath secret;
})
[
"pass"
]
);
};
2025-06-22 12:39:20 -05:00
# fileSystems."/var/lib/${service.name}" = {
# device = service.paths.path0;
# fsType = "none";
# options = [
# "bind"
# ];
# depends = [
# ceres.storage0.mount
# ];
# };
2025-06-22 12:39:20 -05:00
# systemd.tmpfiles.rules = [
# "Z ${service.paths.path0} 0755 ${service.name} ${service.name} -"
# "Z ${service.sops.path0} 0755 ${service.name} ${service.name} -"
# ];
networking = {
firewall = {
allowedTCPPorts = [
service.ports.port0
];
};
};
}