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

22 lines
787 B
Nix

{ 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
'';
}