0

I'm running into an error of error: public key is not valid:

[demo@nixos:~]$ nix-env -i ripgrep
installing 'ripgrep-0.10.0'
these paths will be fetched (0.00 MiB download, 4.76 MiB unpacked):
  /nix/store/xgr3frnb5f13sf3ich8hl8lqbwjqngw9-ripgrep-0.10.0
error: public key is not valid

[demo@nixos:~]$ sudo nix-env -i ripgrep
installing 'ripgrep-0.10.0'
these paths will be fetched (0.00 MiB download, 4.76 MiB unpacked):
  /nix/store/xgr3frnb5f13sf3ich8hl8lqbwjqngw9-ripgrep-0.10.0
error: public key is not valid

I have the following set in my client Nixos:

  nix = {
    binaryCaches = [
      "https://cache.nixos.org/"
      "http://192.168.56.1:8080"
    ];
    binaryCachePublicKeys = [
      "my-nix-cache:aDrIoY93RjzjnMmNYXlKSL3OerPqIGEiqv70CzwWzQvPejwp/89PN6FWkywTYqhjJ/muRT9cJHT4B8S+0pKCjw="
    ];
    trustedUsers = [ "root" "chris" ];
  };

On the server with nix-serve I'm doing:

NIX_SECRET_KEY_FILE="/etc/nixos/nixkeys/key.private" nix-serve -p 8080   
2019/09/29-20:44:00 Starman::Server (type Net::Server::PreFork) starting! pid(17383)
Resolved [*]:8080 to [0.0.0.0]:8080, IPv4
Binding to TCP port 8080 on host 0.0.0.0 with IPv4
Setting gid to "100 100 1 17 27 67 100 131"
cat /etc/nixos/nixkeys/key.public 
my-nix-cache:z3o8Kf/PTzehVpMsE2KoYyf5rkU/XCR0+AfEvtKSgo8=

1 Answer 1

0

I just realized the:

my-nix-cache:z3o8Kf/PTzehVpMsE2KoYyf5rkU/XCR0+AfEvtKSgo8= string does not match what I have in the public key:

my-nix-cache:aDrIoY93RjzjnMmNYXlKSL3OerPqIGEiqv70CzwWzQvPejwp/89PN6FWkywTYqhjJ/muRT9cJHT4B8S+0pKCjw=

... Fixing that makes it work :)

I copied the private key instead of public!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .