edolstra / nix-serve

A standalone Nix binary cache server
GNU Lesser General Public License v2.1
163 stars 37 forks source link

unsable to download nar / HTTP error 500 / failed at nix-serve.psgi line 60 #41

Open PaulGrandperrin opened 2 years ago

PaulGrandperrin commented 2 years ago

Both client and server are on 20-05 and using default conf (AFAICT).

On client:

Internal Server Error; retrying in 1307 ms
error: unable to download 'http://nas.paulg.fr:5000/nar/iwxyfqxhnd7i2ksd4l803jm514gnpd2f.nar': HTTP error 500 ('Internal Server Error')

On server:

Aug 14 11:43:29 nixos-nas nix-serve-start[214715]: error: opening a connection to remote store 'daemon' previously failed at /nix/store/lg9rx0xc0mxy7snxgavz5qv3r9hm4n7z-nix-serve-0.2-e4675e3/libexec/nix-serve/nix-serve.psgi line 60.
amarshall commented 1 year ago

Getting this error (albeit sometimes on a different line, 26) frequently after upgrading to nixos-22.11 (rev 82891b5e2c2359d7e58d08849e4c89511ab94234, Nix 2.11.0). Nix-serve has become, sadly, basically unusable with the frequency of errors.

alejandro-angulo commented 1 year ago

I just ran into this and the issue turned out to be that the user running nix-serve didn't have access to the nix daemon. I think by default the user that runs nix-serve is also called nix-serve. So, in my flake, I added config.nix.settings.allowed-users = ["nix-serve"];.

See here https://github.com/NixOS/nixpkgs/blob/nixos-22.11/nixos/modules/services/misc/nix-daemon.nix#L626-L639