Instruction for installing from another Linux distribution not working

Subsection 2.5.4 of the NixOS manual says that for installing from another Linux distributon you should first execute the following command:

curl https://nixos.org/nix/install | sh

However, this doesn’t work, since that invocation of curl yields no data (when redirecting its output to a file, the file will contain 0 bytes afterwards). With wget and Firefox, downloading does work however,

Is the server somehow configured to not accept requests by curl?

If you use curl -v you can see what is happening:

$ curl -v https://nixos.org/nix/install
...
< HTTP/2 301 
...
< location: https://releases.nixos.org/nix/nix-2.3.10/install

You can see it is trying to redirect you, but curl doesn’t follow redirects by default. You need to pass the -L flag to curl:

$ curl -L https://nixos.org/nix/install | sh

I thought all of these things had been fixed in the manual, but maybe not for the 20.09 release?

@jeltsch would you be willing to send a PR to nixpkgs fixing this? I think if you target the release-20.09 branch, you should be able to find this bad use of curl and fix the documentation.

1 Like

Thanks for the explanation.

Given that I really need my spare time to go through this challenge of setting up NixOS for the first time with the goal of having a working server installation I can rely on for essential services and in the light of the fact that this issue might already be fixed as you say, I’d be happy if someone else could file this PR.

thanks for creating a post @jeltsch , i created a PR to backport the fixes here: https://github.com/NixOS/nixpkgs/pull/107438

3 Likes