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

Setup NIX_PATH correctly in nix-profile-daemon #1664

Merged
merged 1 commit into from May 25, 2018

Conversation

matthewbauer
Copy link
Member

We need nixpkgs to be set in NIX_PATH for Nix 1.12 to work correctly.

@matthewbauer
Copy link
Member Author

/cc @grahamc

Does this look like a good idea? The issue right now is Nix 1.12 will not recognize the path that’s setup by default (nixpkgs is not found) so something like:

nix build nixpkgs.hello

Will fail

@FRidh
Copy link
Member

FRidh commented Jan 11, 2018

What would happen if root would remove its channel?

@matthewbauer
Copy link
Member Author

What would happen if root would remove its channel?

I'm pretty sure Nix just falls back to previous path?

Also @edolstra Reopening this because some people have been hitting it. This should partially fix #2016. I think it should work okay- not sure if there are any objections.

@@ -50,5 +50,5 @@ if test -w $HOME; then
fi

export NIX_SSL_CERT_FILE="@localstatedir@/nix/profiles/default/etc/ssl/certs/ca-bundle.crt"
export NIX_PATH="@localstatedir@/nix/profiles/per-user/root/channels"
export NIX_PATH="${NIX_PATH:+$NIX_PATH:}nixpkgs=@localstatedir@/nix/profiles/per-user/root/channels/nixpkgs:@localstatedir@/nix/profiles/per-user/root/channels"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prepending the previous NIX_PATH is not a good idea because it will cause it to grow every time a (login) subshell is created.

@grahamc
Copy link
Member

grahamc commented Apr 4, 2018 via email

@matthewbauer matthewbauer changed the title Setup nix_path correctly in nix-profile-daemon Setup NIX_PATH correctly in nix-profile-daemon Apr 4, 2018
We need nixpkgs to be set in NIX_PATH for Nix 1.12 to work correctly
@matthewbauer
Copy link
Member Author

matthewbauer commented Apr 4, 2018

Okay removed that line. Note that it is still in nix-profile.sh.in:

https://github.com/NixOS/nix/blob/master/scripts/nix-profile.sh.in#L54-L57

@LnL7
Copy link
Member

LnL7 commented Apr 4, 2018

This should only get sourced once anyway, if we export __ETC_PROFILE_NIX_SOURCED paths can be extended without introducing duplicates.

@edolstra
Copy link
Member

edolstra commented Apr 5, 2018

Polluting the environment with variables like __ETC_PROFILE_NIX_SOURCED is ugly.

@matthewbauer
Copy link
Member Author

Pinging

@edolstra edolstra merged commit 1df32c7 into NixOS:master May 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants