Some checks failed
Run nix flake check / flake-check (push) Has been cancelled
- Move nix-cache CNAME from nix-cache01 to nix-cache02 - Remove actions1 CNAME (service removed) - Update proxy.nix to serve canonical domain on nix-cache02 - Promote nix-cache02 to prod tier with build-host role Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
800 B
Nix
36 lines
800 B
Nix
{ pkgs, config, ... }:
|
|
let
|
|
# nix-cache02 serves the canonical nix-cache.home.2rjus.net
|
|
# nix-cache01 serves nix-cache01.home.2rjus.net (deprecated, pending decommission)
|
|
hostname = config.networking.hostName;
|
|
domain =
|
|
if hostname == "nix-cache02" then
|
|
"nix-cache.home.2rjus.net"
|
|
else
|
|
"${hostname}.home.2rjus.net";
|
|
in
|
|
{
|
|
services.caddy = {
|
|
enable = true;
|
|
package = pkgs.unstable.caddy;
|
|
configFile = pkgs.writeText "Caddyfile" ''
|
|
{
|
|
acme_ca https://vault.home.2rjus.net:8200/v1/pki_int/acme/directory
|
|
metrics
|
|
}
|
|
|
|
|
|
${domain} {
|
|
log {
|
|
output file /var/log/caddy/nix-cache.log {
|
|
mode 644
|
|
}
|
|
}
|
|
metrics /metrics
|
|
|
|
reverse_proxy http://localhost:5000
|
|
}
|
|
'';
|
|
};
|
|
}
|