[Nix#8890] nix-shell fails to parse NIX_PATH #120

Open
opened 2024-03-16 06:45:00 +00:00 by lix-bot · 0 comments
Member

Upstream-Issue: NixOS/nix#8890

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.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/8890 **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 :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
bug
imported
labels 2024-03-16 06:45:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#120
No description provided.