2025-05-24 02:45:00 -05:00
|
|
|
{ config, flake, ... }:
|
|
|
|
let
|
2025-07-03 19:49:48 -05:00
|
|
|
inherit (flake.config.services.instances)
|
|
|
|
glance
|
|
|
|
jellyfin
|
|
|
|
web
|
|
|
|
;
|
|
|
|
inherit (flake.config.machines.devices) ceres mars deimos;
|
|
|
|
configHelpers = {
|
|
|
|
service = glance;
|
|
|
|
hostname = config.networking.hostName;
|
|
|
|
localhost = web.localhost.address0;
|
|
|
|
host = configHelpers.service.domains.url0;
|
|
|
|
};
|
2025-05-25 18:28:37 -05:00
|
|
|
configPath = ./config;
|
|
|
|
configImports = {
|
2025-07-03 20:11:18 -05:00
|
|
|
server = import (configPath + /server.nix) { inherit flake configHelpers; };
|
2025-05-25 18:28:37 -05:00
|
|
|
branding = import (configPath + /branding.nix);
|
|
|
|
theme = import (configPath + /theme.nix);
|
|
|
|
pages = import (configPath + /pages.nix) { inherit config flake; };
|
|
|
|
};
|
2025-05-24 02:45:00 -05:00
|
|
|
in
|
|
|
|
{
|
|
|
|
services = {
|
|
|
|
glance = {
|
|
|
|
enable = true;
|
2025-05-25 18:28:37 -05:00
|
|
|
settings = configImports;
|
|
|
|
};
|
2025-07-03 20:21:14 -05:00
|
|
|
caddy = {
|
|
|
|
virtualHosts = {
|
|
|
|
"${configHelpers.host}" = {
|
|
|
|
extraConfig = ''
|
2025-07-03 20:41:40 -05:00
|
|
|
reverse_proxy ${configHelpers.localhost}:${toString configHelpers.service.ports.port0}
|
2025-07-03 19:49:48 -05:00
|
|
|
|
2025-07-03 20:21:14 -05:00
|
|
|
tls ${configHelpers.service.ssl.cert} ${configHelpers.service.ssl.key}
|
|
|
|
'';
|
|
|
|
};
|
2025-07-03 19:49:48 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2025-05-25 18:28:37 -05:00
|
|
|
sops =
|
|
|
|
let
|
|
|
|
sopsPath = secret: {
|
2025-07-03 20:11:18 -05:00
|
|
|
path = "/run/secrets/${configHelpers.service.name}-${secret}";
|
2025-05-25 18:28:37 -05:00
|
|
|
owner = "root";
|
2025-05-26 14:56:10 -05:00
|
|
|
group = "root";
|
|
|
|
mode = "644";
|
2025-05-24 02:45:00 -05:00
|
|
|
};
|
2025-05-25 18:28:37 -05:00
|
|
|
in
|
|
|
|
{
|
|
|
|
secrets = builtins.listToAttrs (
|
|
|
|
map
|
|
|
|
(secret: {
|
2025-07-03 20:11:18 -05:00
|
|
|
name = "${configHelpers.service.name}-${secret}";
|
2025-05-25 18:28:37 -05:00
|
|
|
value = sopsPath secret;
|
|
|
|
})
|
|
|
|
[
|
|
|
|
# "key"
|
|
|
|
# "${user0}-pass"
|
|
|
|
jellyfin.name
|
|
|
|
]
|
|
|
|
);
|
2025-05-24 02:45:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
networking = {
|
|
|
|
firewall = {
|
|
|
|
allowedTCPPorts = [
|
2025-07-03 20:11:18 -05:00
|
|
|
configHelpers.service.ports.port0
|
2025-05-24 02:45:00 -05:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|