nix-cache: Use caddy-proxy module

This commit is contained in:
Erwin Boskma 2024-06-12 20:56:52 +02:00
parent 3b322619e5
commit c6bd6f90d9
Signed by: erwin
SSH key fingerprint: SHA256:/Wk1WZdLg+vQHs3in9qq7PsIp8SMzwGSk/RLZ5zPuZk

View file

@ -24,6 +24,17 @@
enable = true;
server = true;
};
caddy-proxy = {
enable = true;
package = caddy-with-plugins.packages.${pkgs.system}.caddy-with-cloudflare;
proxyHosts = [
{
externalHostname = "nix-cache.datarift.nl";
proxyAddress = "127.0.0.1:8080";
}
];
};
nix-common = {
enable = true;
remote-builders = true;
@ -130,33 +141,6 @@
};
};
caddy = {
enable = true;
package = caddy-with-plugins.packages.${pkgs.system}.caddy-with-cloudflare;
email = "erwin@datarift.nl";
virtualHosts = {
"nix-cache.datarift.nl" = {
extraConfig = ''
@local_or_ts {
remote_ip 10.0.0.0/24 100.64.0.0/10
}
handle @local_or_ts {
reverse_proxy 127.0.0.1:8080
}
handle {
error "Nope." 403
}
tls {
dns cloudflare {env.CF_API_TOKEN}
}
'';
};
};
};
};
sops.defaultSopsFile = ./secrets.yaml;