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

Make etc/profile.d/nix.sh idempotent #2940

Closed
wants to merge 1 commit into from

Conversation

burke
Copy link

@burke burke commented Jun 11, 2019

Repeatedly loading this file currently creates duplicate entries in PATH, NIX_PATH, and sometimes MANPATH. Testing before inserting prevents this.

@edolstra
Copy link
Member

Arguably this file isn't intended to be idempotent since it should only sourced once (by a login shell).

Repeatedly loading this file currently creates duplicate entries in
PATH, NIX_PATH, and sometimes MANPATH. Testing before inserting prevents
this.
@burke burke force-pushed the idempotent-nix-profile-sh branch from 93c7518 to 89d1679 Compare June 11, 2019 20:07
@burke
Copy link
Author

burke commented Jun 11, 2019

(I've rebased on the current master now)

If you don't want to merge this, I can just continue with my workaround, but it strikes me as good practice for scripts like this to act idempotently even when it's not really intended for them to be sourced multiple times (tooling developers in my org end up evaluating it when we switch branches and reload various shell integrations).

One other thing that strikes me, looking at this file, is that it might be beneficial to unconditionally set MANPATH but leave a trailing : if it's currently empty, which man interprets as fallthrough to the system default path(s).

@burke burke closed this Jul 22, 2019
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

2 participants