config/fish/conf.d/nix.fish

20 lines
627 B
Fish

# https://github.com/NixOS/nix
#
# If nix profile exists:
# - source the profile in bash
# - export the NIX_* variables in fish
# - add nix profile to PATH
#
if test -f ~/.nix-profile/etc/profile.d/nix.sh
for line in (bash -c 'source $0; for name in "${!NIX_@}"; do printf "%s=%s\n" "$name" "${!name}"; done' ~/.nix-profile/etc/profile.d/nix.sh)
set -gx (string split -m 1 = $line)
end
if functions -q fish_add_path
fish_add_path -gP ~/.nix-profile/bin
else
if not contains -- ~/.nix-profile/bin $PATH
set PATH ~/.nix-profile/bin $PATH 2>/dev/null
end
end
end