1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2025-12-06 08:10:43 +01:00

feat(fish): proper PATH initialization

This commit is contained in:
Ryan Cao 2024-09-04 18:39:02 +08:00
parent ea378cf3af
commit 1833524619
Signed by: ryanccn
GPG key ID: 48C96B2057D71CB1
6 changed files with 76 additions and 181 deletions

22
modules/fish.nix Normal file
View file

@ -0,0 +1,22 @@
{ lib, ... }:
{
# https://github.com/LnL7/nix-darwin/issues/122#issuecomment-2272570087
programs.fish.loginShellInit =
let
dquote = str: "\"" + str + "\"";
profiles = [
"/etc/profiles/per-user/$USER" # home-manager profile
"$HOME/.nix-profile" # non-XDG home profile
"$(set -q XDG_STATE_HOME; and echo \"$XDG_STATE_HOME\"; or echo \"$HOME/.local/state\")/nix/profile" # XDG home profile
"/run/current-system/sw" # nix-darwin system profile
"/nix/var/nix/profiles/default" # system profile
];
makeBinSearchPath = lib.concatMapStringsSep " " (path: (dquote "${path}/bin"));
in
''
fish_add_path --move --prepend --path ${makeBinSearchPath profiles}
set fish_user_paths $fish_user_paths
'';
}