[Nix-dev] nixos-rebuild and NIX_PATH

Alexander Foremny alexanderforemny at googlemail.com
Tue May 22 15:15:19 CEST 2012


Hallo,

after upgrading nix to version 1.0 I am trying to build my system
configuration from my custom nixos and nixpkgs repository. I run into
problems after I deleted /etc/nixos/{nixpkgs,nixos} as if I am not
mistaken they are not needed anymore.

However, simply running nixos-rebuild fails.

> $ nixos-rebuild build
> error: file `nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
> error: file `nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
> error: file `nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

Inspecting NIX_PATH this is understandable.

> $ echo $NIX_PATH
> /nix/var/nix/profiles/per-user/root/channels/nixos:nixpkgs=/etc/nixos/nixpkgs:nixos=/etc/nixos/nixos:nixos-config=/etc/nixos/configuration.nix:services=/etc/nixos/services

nixpkgs and nixos are still referenced there. Why is that? Should I
remove those references from NIX_PATH? Where would be a good place to
do that? This should probably apply system-wide. However, removing
those references I still get the same errors.

> $ echo $NIX_PATH
> /nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix
> $ nixos-rebuild build
> building Nix...
> error: file `nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
> error: file `nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)
> error: file `nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

Okay then, maybe I should use the -I option to include my custom nixos
and nixpkgs repositories which are cloned from GitHub. All of the
following commands give the same errors as above (with NIX_PATH is
cleared from the invalid references).

> $ nixos-rebuild -I ~/code/nixos:~/code/nixpkgs build
> $ nixos-rebuild -I ~/code/nixos -I ~/code/nixpkgs build
> $ nixos-rebuild -I nixos=~/code/nixos:nixpkgs=~/code/nixpkgs build
> $ nixos-rebuild -I nixos=~/code/nixos -I nixpkgs=~/code/nixpkgs build

What am I doing wrong? Is it a misunderstanding that I could have
safely removed /etc/nixos/{nixos,nixpkgs}?

Any help would be greatly appreciated.

Regards,
Alexander Foremny


More information about the nix-dev mailing list