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

Broken NIX_PATH tracking issue #9574

Closed
roberth opened this issue Dec 9, 2023 · 13 comments · Fixed by #11079
Closed

Broken NIX_PATH tracking issue #9574

roberth opened this issue Dec 9, 2023 · 13 comments · Fixed by #11079
Labels
bug language The Nix expression language; parser, interpreter, primops, evaluation, etc settings Settings, global flags, nix.conf

Comments

@roberth
Copy link
Member

roberth commented Dec 9, 2023

Describe the bug

NIX_PATH environment variable does not work when nix.conf has a nix-path setting.
This is highly unexpected and not intentional.
Multiple issues and PRs exist, but solving this problem has proven difficult within the established abstractions for settings handling.

Issues

PRs

Priorities

Add 👍 to issues you find important.

@roberth roberth added bug language The Nix expression language; parser, interpreter, primops, evaluation, etc settings Settings, global flags, nix.conf labels Dec 9, 2023
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/disabling-channels-breaks-nix-path-resolution/34825/3

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-path-is-not-recognized/38404/6

catbrained added a commit to catbrained/dotfiles that referenced this issue Mar 2, 2024
See: NixOS/nix#9574

Signed-off-by: Linda Siemons <linda@catbrained.dev>
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-04-22-nix-team-meeting-minutes-141/44083/1

@colonelpanic8
Copy link

@roberth @fricklerhandwerk I'm happy to take another swing at this one.

Seems like https://github.com/NixOS/nix/pull/9066/files should probably be used as a starting point for testing.

w.r.t. your comment here #8902 (comment)

it seems like you are saying that there is probably some issue with what I did in this pr, w.r.t. the interaction between NIX_PATH and restrict-eval, but its not quite clear to me what exactly the issue is, and whether you and @thufschmitt ever did sit down and figure out a resolution or not. Just want to make sure that I'm not missing any details that you guys worked out or decided on before I spend more time on this.

Happy to jump on a call or discuss over text chat or something as well.

Thanks!

@colonelpanic8
Copy link

Would also be happy to use #7871 as a starting point if we feel like that is a better route.

I don't have a super strong recollection of what I even did in my PR, but I do vaguely recall that it did have the advantage of having a more "correct" version of the behavior w.r.t. precedence of the command line arguments.

@fricklerhandwerk
Copy link
Contributor

@colonelpanic8 thanks a lot, I appreciate your support! Feel free to join the maintainer meetings if you'd like to talk.

We did sit down, which resulted in the top post of #9066 that describes the expected behavior, which is currently violated. It should be tested exhaustively and then fixed. We discussed last time (and the details aren't written down because there were too many) that the test setup as it is stands in the way to do this cleanly, and we'd like to first see how to approach that.

@colonelpanic8
Copy link

@fricklerhandwerk oh, wait so it seems like you just happened to pick this up again recently? I had assumed that since so much time had passed since the creation of #9066 that no one was actively working on this and that there may not even be any plans to fix the issue.

I'm definitely eager to help out here (this issue is kind of a major annoyance for me) but if you are already actively working on fixing the issue (and it sounds like maybe you have plans to pair on it with eelco), I wonder if I might just be stepping on toes by involving myself.

I'd love to hear your honest opinion on whether my involvement would be helpful at this stage. I'm definitely happy to attend the meeting, and work on any parts of this (even if they are tedious as with the testing).

@SuperSandro2000
Copy link
Member

@fricklerhandwerk
Copy link
Contributor

already actively working on fixing the issue

This would be an exaggeration. It's on my mind and I dabbled at it, but I didn't make progress. Talking it through and walking through the code with someone would definitely help with that. But don't rely on me. Feel free to make your own investigations and discuss them here or as pull requests.

JManch added a commit to JManch/nix-starter-configs that referenced this issue May 1, 2024
Misterio77 pushed a commit to Misterio77/nix-starter-configs that referenced this issue May 2, 2024
@piegamesde
Copy link
Member

While this is definitely a Nix bug, I'd argue that the NixOS module is broken as well: The nix.nixPath option sets environment.sessionVariables.NIX_PATH instead of settings.nix-path, which is surprising.

However, even with both of these fixed, I'd argue that the general behavior and interaction between these two would be suboptimal and surprising: If one configures the Nix path through nix.conf and then a script goes along and wants to append to NIX_PATH, it will effectively override the existing path instead of appending, which is clearly not intended. (The alternative of appending/merging both is equally problematic for other reasons. Maybe the two simply should not coexist …)

NovaViper added a commit to NovaViper/NixConfig that referenced this issue May 6, 2024
- Removed top level `with` declarations
- Applied workaround for nixPath, NixOS/nix#9574
- Moved repeated settings into global config files
- Replaced tree in favor of eza in fzf change directory widget
- Made tmux switch window keybindings actually execute properly
- Removed custom zsh-autosuggestion highlight option, use the defaults
- Made plasma-manager modify icon theme again
- Removed cmatrix
- Added several packages
  - fd
  - procs
  - nixd
- Doom Emacs modifications
  - Added zoxide.el package
  - Added ibuffer module
- Make Home-Manager NixOS module use global packages
- Switched to sunshine nixos module
- Simplify nixpkgs import for shell and custom packages
- Added btop GPU flags
- Added more history filters for atuin
- Fixed btop theme conflict for live-image build
NovaViper added a commit to NovaViper/NixConfig that referenced this issue May 6, 2024
- Removed top level `with` declarations
- Applied workaround for nixPath, NixOS/nix#9574
- Moved repeated settings into global config files
- Replaced tree in favor of eza in fzf change directory widget
- Made tmux switch window keybindings actually execute properly
- Removed custom zsh-autosuggestion highlight option, use the defaults
- Made plasma-manager modify icon theme again
- Removed cmatrix
- Added several packages
  - fd
  - procs
  - nixd
- Doom Emacs modifications
  - Added zoxide.el package
  - Added ibuffer module
- Make Home-Manager NixOS module use global packages
- Switched to sunshine nixos module
- Simplify nixpkgs import for shell and custom packages
- Added btop GPU flags
- Added more history filters for atuin
- Fixed btop theme conflict for live-image build
NovaViper added a commit to NovaViper/NixConfig that referenced this issue May 6, 2024
- Removed top level `with` declarations
- Applied workaround for nixPath, NixOS/nix#9574
- Moved repeated settings into global config files
- Replaced tree in favor of eza in fzf change directory widget
- Made tmux switch window keybindings actually execute properly
- Removed custom zsh-autosuggestion highlight option, use the defaults
- Made plasma-manager modify icon theme again
- Removed cmatrix
- Removed wezterm tmux-on configuration
- Wezterm on configuration only loads when NOT using tmux
- Added several packages
  - fd
  - procs
  - nixd
- Doom Emacs modifications
  - Added zoxide.el package
  - Added ibuffer module
- Make Home-Manager NixOS module use global packages
- Switched to sunshine nixos module
- Simplify nixpkgs import for shell and custom packages
- Added btop GPU flags
- Added more history filters for atuin
- Fixed bat theme conflict for live-image build
Infinidoge added a commit to Infinidoge/universe that referenced this issue May 11, 2024
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/24-05-add-flake-to-nix-path/46310/11

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-06-05-nix-team-meeting-minutes-150/46583/1

axelf4 added a commit to axelf4/nixos-config that referenced this issue Jun 9, 2024
Disabling nix.channel.enable makes nix-path default to an empty
string. Due to NixOS/nix#9574 this overrides the NIX_PATH environment
variable, meaning <nixpkgs> lookup paths fail to resolve. Workaround
by setting nix-path explicitly until it is fixed.
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/why-is-an-older-version-of-an-app-getting-installed-here/49413/7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug language The Nix expression language; parser, interpreter, primops, evaluation, etc settings Settings, global flags, nix.conf
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants