From 96ef57ff63f1e9a587a29181315614bddeb0a208 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Tue, 12 Mar 2024 22:29:22 +0800 Subject: [PATCH] darwin/core: simplify fish shell $PATH workaround --- darwin/profiles/common/core/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/darwin/profiles/common/core/default.nix b/darwin/profiles/common/core/default.nix index a73a3b4..3bb0202 100644 --- a/darwin/profiles/common/core/default.nix +++ b/darwin/profiles/common/core/default.nix @@ -39,14 +39,13 @@ programs.zsh.enable = true; # default shell on catalina programs.fish.enable = true; - # fucking horrible + # WORKAROUND: Fix $PATH orders when using Fish shell # https://github.com/LnL7/nix-darwin/issues/122#issuecomment-1659465635 programs.fish.loginShellInit = let - dquote = str: "\"" + str + "\""; - - makeBinPathList = map (path: path + "/bin"); + # ["$HOME/.local" "/usr/local"] -> "'$HOME/.local/bin' '/usr/local/bin'" + makePath = path: lib.concatMapStringsSep " " (path: lib.escapeShellArg "${path}/bin") path; in '' - fish_add_path --move --prepend --path ${lib.concatMapStringsSep " " dquote (makeBinPathList config.environment.profiles)} + fish_add_path --move --prepend --path ${makePath config.environment.profiles} set fish_user_paths $fish_user_paths '';