Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix-shell no longer respects NIX_PATH #10246

Open
SuperSandro2000 opened this issue Mar 14, 2024 · 4 comments
Open

nix-shell no longer respects NIX_PATH #10246

SuperSandro2000 opened this issue Mar 14, 2024 · 4 comments
Labels

Comments

@SuperSandro2000
Copy link
Member

Describe the bug

When running NIX_PATH=nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz command nix-shell --option nix-path "" -p bash I am only greeted with

error:
       … while calling the 'import' builtin
         at «string»:1:18:
            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (bash) ]; } ""
             |                  ^

       … while realising the context of a path

       … while calling the 'findFile' builtin
         at «string»:1:25:
            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (bash) ]; } ""
             |                         ^

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

but command nix-shell --option nix-path nixpkgs=https://github.com/SuperSandro2000/nixpkgs/archive/nixos-unstable.tar.gz -p bash works as expected

Steps To Reproduce

  1. Run NIX_PATH=nixpkgs=https://github.com/nixos/nixpkgs/archive/nixos-unstable.tar.gz command nix-shell --option nix-path "" -p bash

Expected behavior

It should work as it did with 2.20 or 2.18.

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

Additional context

Add any other context about the problem here.

Priorities

Add 👍 to issues you find important.

@thufschmitt
Copy link
Member

Did it use to work?

This looks like the broken semantics “documented” in #9066

(not saying it's not an issue, just clarifying whether this is the same old bug or a real regression)

@SuperSandro2000
Copy link
Member Author

Did it use to work?

As soon as I switch back to 2.20 or 2.18 by changing nix.package it starts to work again.

@thufschmitt
Copy link
Member

Weird, I can reproduce that for every Nix version >= 2.4 (2.3 works, but that's just because it doesn't have the nix-path setting)

@nasrally
Copy link

I see identical behavior on 2.18.1.

NIX_PATH is completely ignored by nix-shell yet it is present in the environment variables, I can see it in /proc/PID/environ, defining the nix-path setting in either /etc/nix/nix.conf (through NixOS), $HOME/.config/nix/nix.conf (through HM) or --option nix-path nixpkgs=... DOES WORK.

Maybe important context that makes this unrelated — it started doing that after I disabled channels on NixOS with nix.channel.enable = false (because I want complete flakification)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants