about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-01-07T00·47+0300
committerclbot <clbot@tvl.fyi>2022-01-07T01·30+0000
commitb8e011f7927e63383b3f22ae32eb53fc86449315 (patch)
tree0b9c61d6025b83d67f5a91b3e710cc5ad021da52
parent1bd6c2a85ba91ff4f1a738052fe88162d670a83b (diff)
chore(cache.tvl.su): Raise cache priority to 50 r/3525
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>
-rw-r--r--ops/modules/www/cache.tvl.su.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/ops/modules/www/cache.tvl.su.nix b/ops/modules/www/cache.tvl.su.nix
index 633178b5ccec..99bc008cd6a5 100644
--- a/ops/modules/www/cache.tvl.su.nix
+++ b/ops/modules/www/cache.tvl.su.nix
@@ -17,6 +17,11 @@
           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};
         }