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

extend NIX_PATH in nix-daemon.sh #1484

Closed
wants to merge 1 commit into from

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Jul 24, 2017

The current nix-daemon.sh assumes it's loaded first, but that's not necessary the case.
Since the new installer sources this at the end of /etc/profile it will run after /etc/bashrc.

I'm also not sure why it's loaded in both profile and bashrc. /cc @grahamc

@grahamc
Copy link
Member

grahamc commented Jul 25, 2017

LGTM

To be frank, I don't recall exactly why it is loaded in both places. I feel this may have been from some info from @cleverca22.

@grahamc
Copy link
Member

grahamc commented Jul 25, 2017

cc @domenkozar

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 31, 2017

The exact details are very arbitrary and complex, but in short .profile is only for interactive login shells, and .bashrc only for interactive non-login shells. While its commonplace for one to source the other, and interactive non-login shells to be ultimately forked from interactive login shells, these are technically orthogonal.

I have no idea what the best route is.

@LnL7
Copy link
Member Author

LnL7 commented Aug 29, 2017

@Ericson2314 yes, but bashrc will get loaded in both cases because /etc/profile has this:

if [ "${BASH-no}" != "no" ]; then
        [ -r /etc/bashrc ] && . /etc/bashrc
fi

@grahamc
Copy link
Member

grahamc commented Sep 17, 2017

@edolstra would you like to merge this?

@edolstra
Copy link
Member

Dunno, this seems dangerous to me because it can lead to NIX_PATH growing on every shell invocation.

@Ericson2314
Copy link
Member

@LnL7 This is on macOS or NixOS, or something else. I've seen such things but have no idea where that comes from / what convention it is?

@edolstra We could only conditionally append, to be idempotent.

@LnL7
Copy link
Member Author

LnL7 commented Sep 18, 2017

I guess the main issue here is that this is loaded in multiple places, /etc/profile unexpectedly loads this a second time after /etc/bashrc is finished getting rid of any changes that happened there.

@Ericson2314 This is only used on macOS AFAIK.

@cbarrett
Copy link

@LnL7 This file also clobbers NIX_PROFILES which will also mess up nix-darwin IIUC

@LnL7
Copy link
Member Author

LnL7 commented Jan 4, 2018

Closing in favour of #1774

@LnL7 LnL7 closed this Jan 4, 2018
@LnL7 LnL7 deleted the extend-nix-path branch January 4, 2018 21:34
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