Skip to content

Commit

Permalink
fish: add patch to fix $PATH for nix-darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
emilazy committed Oct 31, 2024
1 parent 05e3b3d commit 6b9c7f2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkgs/shells/fish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,20 @@ let
hash = "sha256-YUyfVkPNB5nfOROV+mu8NklCe7g5cizjsRTTu8GjslA=";
};

patches = [
# We don’t want to run `/usr/libexec/path_helper` on nix-darwin,
# as it pulls in paths not tracked in the system configuration
# and messes up the order of `$PATH`. Upstream are unfortunately
# unwilling to accept a change for this and have recommended that
# it should be a distro‐specific patch intesad.
#
# See:
#
# * <https://github.com/LnL7/nix-darwin/issues/122>
# * <https://github.com/fish-shell/fish-shell/issues/7142>
./nix-darwin-path.patch
];

# Fix FHS paths in tests
postPatch = ''
# src/fish_tests.cpp
Expand Down
13 changes: 13 additions & 0 deletions pkgs/shells/fish/nix-darwin-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/share/config.fish b/share/config.fish
index d85fd1e185..1d2b5dd598 100644
--- a/share/config.fish
+++ b/share/config.fish
@@ -156,7 +156,7 @@
# Some things should only be done for login terminals
# This used to be in etc/config.fish - keep it here to keep the semantics
#
-if status --is-login
+if status --is-login && not set -q __NIX_DARWIN_SET_ENVIRONMENT_DONE
if command -sq /usr/libexec/path_helper
# Adapt construct_path from the macOS /usr/libexec/path_helper
# executable for fish; see

0 comments on commit 6b9c7f2

Please sign in to comment.