2024-10-06 15:25:05 -05:00
|
|
|
{flake, ...}: let
|
|
|
|
inherit (flake.config.people) user0;
|
2024-10-19 18:22:29 -05:00
|
|
|
inherit (flake.config.system.device) server;
|
|
|
|
inherit (flake.config.service.instance) jellyfin web;
|
|
|
|
service = jellyfin;
|
|
|
|
localhost = web.localhost.address0;
|
|
|
|
host = "${service.subdomain}.${web.domains.url0}";
|
2024-10-06 15:25:05 -05:00
|
|
|
in {
|
|
|
|
services = {
|
|
|
|
jellyfin = {
|
|
|
|
enable = true;
|
|
|
|
openFirewall = true;
|
|
|
|
user = user0;
|
|
|
|
};
|
|
|
|
jellyseerr = {
|
|
|
|
openFirewall = true;
|
|
|
|
enable = true;
|
|
|
|
};
|
|
|
|
caddy = {
|
|
|
|
virtualHosts = {
|
|
|
|
"${host}" = {
|
|
|
|
extraConfig = ''
|
|
|
|
redir /.well-known/carddav /remote.php/dav/ 301
|
|
|
|
redir /.well-known/caldav /remote.php/dav/ 301
|
|
|
|
|
2024-10-19 18:22:29 -05:00
|
|
|
reverse_proxy ${localhost}:${toString service.ports.port1}
|
2024-10-06 15:25:05 -05:00
|
|
|
|
2024-10-19 18:22:29 -05:00
|
|
|
tls ${service.ssl.cert} ${service.ssl.key}
|
2024-10-06 15:25:05 -05:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems = let
|
|
|
|
settings = {
|
|
|
|
fsType = "none";
|
|
|
|
options = ["bind"];
|
|
|
|
depends = [server.storage0.mount];
|
|
|
|
};
|
|
|
|
in {
|
2024-10-19 18:22:29 -05:00
|
|
|
"/var/lib/${service.name}" =
|
2024-10-06 15:25:05 -05:00
|
|
|
{
|
2024-10-19 18:22:29 -05:00
|
|
|
device = service.paths.path0;
|
2024-10-06 15:25:05 -05:00
|
|
|
}
|
|
|
|
// settings;
|
2024-10-19 18:22:29 -05:00
|
|
|
"/var/cache/${service.name}" =
|
2024-10-06 15:25:05 -05:00
|
|
|
{
|
2024-10-19 18:22:29 -05:00
|
|
|
device = "${service.paths.path0}/cache";
|
2024-10-06 15:25:05 -05:00
|
|
|
}
|
|
|
|
// settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.tmpfiles.rules = [
|
2024-10-19 18:22:29 -05:00
|
|
|
"Z ${service.paths.path0} 0755 ${user0} ${service.name} -"
|
|
|
|
"Z ${service.paths.path0}/cache 0755 ${user0} ${service.name} -"
|
2024-10-06 15:25:05 -05:00
|
|
|
];
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
firewall = {
|
|
|
|
allowedTCPPorts = [
|
2024-10-19 18:22:29 -05:00
|
|
|
service.ports.port0
|
|
|
|
service.ports.port1
|
|
|
|
service.ports.port2
|
2024-10-06 15:25:05 -05:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|