b8e011f792
The priority of binary caches is decided by the remotes in Nix (???), and by default nix-serve (which is *very* slow) has a lower priority than cache.nixos.org (which means that it will be preferred over the faster cache for paths that exist on both). To avoid this, override the hardcoded (????) priority by serving the nix-cache-info response directly from nginx instead. Change-Id: I15a2d6618386d16edaf69f1c9257a36bd72132d2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4823 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi>
31 lines
669 B
Nix
31 lines
669 B
Nix
{ config, ... }:
|
|
|
|
{
|
|
imports = [
|
|
./base.nix
|
|
];
|
|
|
|
config = {
|
|
services.nginx.virtualHosts."cache.tvl.su" = {
|
|
serverName = "cache.tvl.su";
|
|
serverAliases = [ "cache.tvl.fyi" ];
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
|
|
extraConfig = ''
|
|
location = /cache-key.pub {
|
|
alias /run/agenix/nix-cache-pub;
|
|
}
|
|
|
|
location = /nix-cache-info {
|
|
add_header Content-Type text/plain;
|
|
return 200 "StoreDir: /nix/store\nWantMassQuery: 1\nPriority: 50\n";
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://localhost:${toString config.services.nix-serve.port};
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
}
|