[Nix-dev] Understanding NIX_PATH

Eike eike at eknet.org
Sat Jun 13 12:54:45 CEST 2015


Hello all,

I just encountered a problem that I cannot figure out myself. I switched
from the 14.12 channel to the unstable channel (in NixOS) and when doing
nixos-rebuild build I get the following:

    # nix-channel --list
    nixos https://nixos.org/channels/nixpkgs-unstable

    # nixos-rebuild build
    building Nix...
    error: file ‘nixpkgs/nixos’ was not found in the Nix search path (add it using $NIX_PATH or -I)
    error: file ‘nixpkgs/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)
    /tmp/nixos-rebuild.lH7Hoj/nix
    building the system configuration...
    error: file ‘nixpkgs/nixos’ was not found in the Nix search path (add it using $NIX_PATH or -I)

My nix env is this:

    # env |grep -i ^nix
    NIX_PROFILES=/run/current-system/sw /nix/var/nix/profiles/default /root/.nix-profile
    NIX_CONF_DIR=/etc/nix
    NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos:nixpkgs=/etc/nixos/nixpkgs:nixos-config=/etc/nixos/configuration.nix
    NIX_OTHER_STORES=/run/nix/remote-stores/*/nix
    NIXPKGS_CONFIG=/etc/nix/nixpkgs-config.nix
    NIX_USER_PROFILE_DIR=/nix/var/nix/profiles/per-user/root

I can see that the 'nixpkgs=/etc/nixos/nixpkgs' part in NIX_PATH points
to a non-existing thing. But it always did so and the command works in
the same env if the 14.12 channel is active.

I always wondered about why is nixpkgs pointing to a non-existing thing?

And why is the unstable channel not building for me?

Thank you and kind regards
Eike


More information about the nix-dev mailing list