fish: add nix-env plugin
This commit is contained in:
parent
532e9c9793
commit
b6417ac732
@ -1,21 +0,0 @@
|
||||
# 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
|
@ -2,5 +2,6 @@ jorgebucaran/fisher
|
||||
jorgebucaran/replay.fish
|
||||
oakninja/MakeMeFish
|
||||
laughedelic/fish_logo
|
||||
lilyball/nix-env.fish
|
||||
jethrokuan/z
|
||||
reitzig/sdkman-for-fish@v1.4.0
|
||||
|
@ -3,12 +3,20 @@
|
||||
echo "***** INSTALL NIX PACKAGES *****"
|
||||
|
||||
ROOTDIR=$(cd "$(dirname "$0")/.." && pwd)
|
||||
NIX_ENV="$HOME/.nix-profile/bin/nix-env"
|
||||
|
||||
if [ -x "$NIX_ENV" ]; then
|
||||
"$NIX_ENV" --install --remove-all --file "$ROOTDIR/nix/packages.nix"
|
||||
else
|
||||
echo "Cannot install Nix packages! $NIX_ENV is not executable."
|
||||
found_nix_command=0
|
||||
|
||||
for profile in "$HOME/.nix-profile" "/nix/var/nix/profiles/default"
|
||||
do
|
||||
if test -x "$profile/bin/nix-env"; then
|
||||
"$profile/bin/nix-env" --install --remove-all --file "$ROOTDIR/nix/packages.nix"
|
||||
found_nix_command=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test $found_nix_command -ne 1; then
|
||||
echo "Cannot install Nix packages! Command not found: nix-env"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
@ -5,7 +5,7 @@ echo "***** INSTALL NIX *****"
|
||||
if [ -d /nix ]; then
|
||||
echo "Nix is already installed."
|
||||
else
|
||||
/bin/bash -c "$(curl -fsSL https://nixos.org/nix/install) --no-daemon"
|
||||
curl -fsSL https://nixos.org/nix/install | sh
|
||||
fi
|
||||
|
||||
echo
|
||||
|
Loading…
x
Reference in New Issue
Block a user