config/fish/conf.d/nix.fish

22 lines
703 B
Fish

# Nix package manager
#
# If Nix is installed:
# - source the profile with bash
# - export the NIX_* variables in fish
# - add Nix profile to PATH
#
# There is no fish profile to source yet.
# https://github.com/NixOS/nix/issues/1512
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