Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for manually setting the priority #19

Open
busti opened this issue Jun 25, 2021 · 1 comment · May be fixed by #46
Open

Allow for manually setting the priority #19

busti opened this issue Jun 25, 2021 · 1 comment · May be fixed by #46

Comments

@busti
Copy link

busti commented Jun 25, 2021

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.

e1mo added a commit to e1mo/nix-serve that referenced this issue Feb 20, 2023
@e1mo e1mo linked a pull request Feb 20, 2023 that will close this issue
@Dietr1ch
Copy link

Dietr1ch commented Sep 19, 2024

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";
    };
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants