CrOS/modules/users/overseer/services.nix
2025-01-21 09:48:47 -05:00

82 lines
2 KiB
Nix

let
volumePath = "/overseer/services";
in
{
lib,
inputs,
config,
pkgs,
...
}:
lib.mkIf config.user.overseer.enable {
# Some scafolding for secrets
sops = {
defaultSopsFile = inputs.nix-secrets.secrets.overseer;
age.keyFile = "/var/lib/sops-nix/key.txt";
age.generateKey = true;
};
# Create the dirs we need
systemd.tmpfiles.rules = [
"d ${volumePath}"
];
# Pull in the restic secrets from sops
sops.secrets."restic/url" = {};
sops.secrets."restic/key" = {};
# (Arguably) Most Important Service - backups
services.restic.backups = {
homebox = {
user = "root";
timerConfig = {
OnCalendar = "hourly";
Persistent = true;
};
paths = [
"/var/lib/homebox/data"
];
repositoryFile = config.sops.secrets."restic/url".path;
passwordFile = config.sops.secrets."restic/key".path;
};
};
# OCI services
virtualisation.podman.enable = true;
virtualisation.oci-containers.backend = "podman";
# These ports are needed for NGINX Proxy Manager
networking.firewall.allowedTCPPorts = [
443
80
];
services.nginx = {
enable = true;
virtualHosts = {
"homebox.wanderingcrow.net" = {
listen = [
{
addr = "0.0.0.0";
port = 80;
ssl = false;
}
];
locations."/" = {
proxyPass = "http://localhost:7745";
proxyWebsockets = true;
};
};
};
};
services = {
homebox = {
enable = true;
settings = {
HBOX_OPTIONS_ALLOW_REGISTRATION = "true";
HBOX_SWAGGER_HOST = "localhost:7745";
HBOX_SWAGGER_SCHEME = "http";
};
};
};
}