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

[WIP] fish: work around default path_helper shuffling PATH #123

Closed
wants to merge 1 commit into from

Conversation

thefloweringash
Copy link
Contributor

Wrap the main fish config to undo its changes to PATH in
path_helper. It puts injected paths before other entries, which causes
nix-specific paths to appear after system paths.

Fixes #122.

@thefloweringash
Copy link
Contributor Author

thefloweringash commented Feb 9, 2019

It's a little disappointing to clobber the path_helper mechanism, but this is consistent with other shells under nix-darwin.

Wrap the main fish config to undo its changes to PATH in
path_helper. It puts injected paths before other entries, which causes
nix-specific paths to appear after system paths.
@thefloweringash thefloweringash changed the title fish: work around default path_helper shuffling PATH [WIP] fish: work around default path_helper shuffling PATH Feb 10, 2019
@thefloweringash
Copy link
Contributor Author

I think the nixpkgs initialization is inhibited in child shells, which will break this approach.

@LnL7
Copy link
Owner

LnL7 commented Feb 10, 2019

@thefloweringash
Copy link
Contributor Author

The short answer is: this doesn't work. I don't know if I can fix it yet. Also I'm not familiar with fish either, first time looking at it trying to fix this!

The longer answer: it tries to work exactly the same as NixOS, but fish internally rewrites the PATH on every shell, so we're trying to undo that.

NixOS sets up environment once per shell tree, ignoring what kind of shell it is. This is a coarse but effective approach that means running commands directly from ssh work. Most shells are either launched with a clean environment for NixOS to setup, or launched as non-login shells.

The macOS path_helper isn't a problem for bash for two reasons:

  1. it only runs for login shells
  2. it runs before the nix-darwin module replaces the PATH.

(1) allows child shells to inherit paths, since they're typically non-login.
(2) allows nix-darwin to have the final say in the value of PATH

Neither of these are currently true in fish in nix-darwin. (1) was true, but was reverted, and (2) is a consequence of nix injecting the environment early in fish's lifecycle. I'm not sure which problems the early injection fixes. Maybe we could do environment configuration at the top of /etc/fish/config.fish, so as to run after the path_helper?

@thefloweringash
Copy link
Contributor Author

I don't think this is the right approach. Sorry for noise.

@thefloweringash thefloweringash deleted the fish-path branch February 20, 2019 08:40
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.

2 participants