Nixos-config not found in Nix search path

I’m just installing NixOS for the first time. I added a flakes configuration but then decided I don’t want to use flakes for now and removed the flake related configuration from /etc/nixos/configuration.nix. I now get the above error message. Now I can’t even seem to re-add the flake config and get it to work. My $NIX_PATH is: nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels

I was under the impression ‘nixos-config’ was an executable and was unable to find it. I now know that’s just a variable for where the configuration file is which can be set with -I. I’m set now.

Im trying sudo nixos-rebuild -I /etc/nixos/configuration.nix switch, but it gives the same error.
did you do anything else?

I experienced the same error.

Solution:
providing the path via -I flag needs to be done like that

$ sudo nixos-rebuild boot -I nixos-config=path-to-my-config.nix --upgrade

(source: NixOS for the Impatient )

1 Like