The NixOS Manual describes a procedure for installing NixOS from another Linux distribution, which involves running some code as an ordinary user and some code as root
. However, when I follow this approach, nixos-install
fails, complaining it can’t find <nixpkgs/nixos>
(from what I remember) and suggesting to add the relevant directory to NIX_PATH
.
The procedure described in the manual involves setting NIX_PATH
for the nixos-install
invocation according to the value of NIX_PATH
that the ordinary user sees. However, NIX_PATH
is not set for the ordinary user. Still, running nix-instantiate --eval -E '<nixpkgs/nixos>'
as the ordinary user succeeds. Apparently, there is some additional magic that makes Nix find <nixpkgs/nixos>
when working as the ordinary user, but not when working as root
.
Could the manual please be fixed such that the description of how to install NixOS from another Linux distribution is correct again?
I quickly tried to install NixOS performing everything as root
, and at a first glance this seems to work. However, running in particular https://nixos.org/nix/install
as root
is not recommended. Is there any inherent problem with performing the whole installation as root
? I understand that you should minimize the amount of code executions as root
, but in my case the installation is performed from a rescue system, where there is not much to damage. Can I rely on a root
-only installation giving a correct result?