Skip to content

nix-shell fails to parse NIX_PATH #8890

@farnoy

Description

@farnoy

Describe the bug

nix-shell isn't able to understand the NIX_PATH env var to locate <nixpkgs>.

Steps To Reproduce

  1. $ NIX_PATH="nixpkgs=/nix/store/066hr2pmppfzfsn1d6lb9485hniz5p53-source" nix-shell -p nix-info --run "nix-info -m"

Fails with:

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

       at «string»:1:25:

            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (nix-info) ]; } ""
             |                         ^
(use '--show-trace' to show detailed location information)

Expected behavior

I expected it to work the same way as when executed this way:
nix-shell -I nixpkgs=/nix/store/066hr2pmppfzfsn1d6lb9485hniz5p53-source -p nix-info --run "nix-info -m"

nix-env --version output
nix-env (Nix) 2.13.5

Additional context

I think I only started seeing this after setting nix.channel.enable = false; in my NixOS config, but I don't think it should be relevant in any way since I'm specifying NIX_PATH explicitly in the examples above.

EDIT: My nix.conf includes nix-path = (blank) as a consequence of my NixOS setup. See comments below.

Priorities

Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions