chore(cache.tvl.su): Raise cache priority to 50

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>
This commit is contained in:
Vincent Ambo 2022-01-07 03:47:18 +03:00 committed by clbot
parent 1bd6c2a85b
commit b8e011f792

View file

@ -17,6 +17,11 @@
alias /run/agenix/nix-cache-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 / { location / {
proxy_pass http://localhost:${toString config.services.nix-serve.port}; proxy_pass http://localhost:${toString config.services.nix-serve.port};
} }