config/modules/nixos/sites/cache/default.nix
2025-04-27 11:11:51 -04:00

38 lines
726 B
Nix

{
lib,
config,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.sites.cache;
sec = config.age.secrets;
in {
options.sites.cache = with types; {
enable = mkBoolOpt false "Enable Hydra";
};
config = mkIf cfg.enable {
age.secrets = {
cache_key = {
file = ./sec/cache_key.age;
};
};
services.nix-serve = {
enable = true;
secretKeyFile = sec.cache_key.path;
port = 12024;
};
services.nginx.virtualHosts."cache.zoeys.computer" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}";
};
};
};
}