From c406d3b63011f529f2a6e33844fb7c5679076e57 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 31 Oct 2024 17:09:30 +0000 Subject: [PATCH] fish: add patch to fix `$PATH` for nix-darwin --- pkgs/shells/fish/default.nix | 14 ++++++++++++++ pkgs/shells/fish/nix-darwin-path.patch | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 pkgs/shells/fish/nix-darwin-path.patch diff --git a/pkgs/shells/fish/default.nix b/pkgs/shells/fish/default.nix index 82ba76c005b8b..75353691a6638 100644 --- a/pkgs/shells/fish/default.nix +++ b/pkgs/shells/fish/default.nix @@ -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 instead. + # + # See: + # + # * + # * + ./nix-darwin-path.patch + ]; + # Fix FHS paths in tests postPatch = '' # src/fish_tests.cpp diff --git a/pkgs/shells/fish/nix-darwin-path.patch b/pkgs/shells/fish/nix-darwin-path.patch new file mode 100644 index 0000000000000..0c9ef7f2701a9 --- /dev/null +++ b/pkgs/shells/fish/nix-darwin-path.patch @@ -0,0 +1,12 @@ +diff --git a/share/config.fish b/share/config.fish +index d85fd1e185..c564e45b27 100644 +--- a/share/config.fish ++++ b/share/config.fish +@@ -158,6 +158,7 @@ + # + if status --is-login + if command -sq /usr/libexec/path_helper ++ and not set -q __NIX_DARWIN_SET_ENVIRONMENT_DONE + # Adapt construct_path from the macOS /usr/libexec/path_helper + # executable for fish; see + # https://opensource.apple.com/source/shell_cmds/shell_cmds-203/path_helper/path_helper.c.auto.html .