Open busti opened 3 years ago
Might be a bit late, but nix-serve-ng supports a flag for this,
I found myself running this,
services = {
# https://search.nixos.org/options?channel=unstable&type=packages&query=nix-serve
nix-serve = {
enable = true;
# Use nix-serve-ng. https://github.com/aristanetworks/nix-serve-ng
package = pkgs.nix-serve-ng;
openFirewall = false; # Served through nginx
extraParams = lib.concatStringsSep " " [
"--priority 40" # (Match priority of https://cache.nixos.org/nix-cache-info as my machines may be offline)
];
# Generate keys with,
# sudo nix-store \
# --generate-binary-cache-key \
# "nix-store--$(hostname)" \
# /var/keys/nix-store-private.pem \
# /var/keys/nix-store-public.pem
secretKeyFile = "/var/keys/nix-store-private.pem";
};
};
The priority of the binary cache info file is currently hardcoded to
30
https://github.com/edolstra/nix-serve/blob/master/nix-serve.psgi#L18, it would be nice to have an option to change this value, i.e. using a command-line parameter.This would be especially useful when running multiple binary caches. I personally run 3 binary caches, one on my vserver, one at home and one at the local hackerspace. It would be nice to have nixos automatically chose the caches in the local network, which setting the priority would facilitate.