If Nix profile environment exist, source it before installation check

This commit is contained in:
Domen Kožar 2021-10-14 13:21:13 -05:00
parent 3e0e991ad2
commit c5729e9110

View File

@ -1,6 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
profileEnv=$HOME/.nix-profile/etc/profile.d/nix.sh
# if Nix profile already exists, source the environment. This is mostly useful for self-hosted runners, see issue #98
if [[ -f $profileEnv ]]; then
source $profileEnv
fi
if type -p nix &>/dev/null ; then if type -p nix &>/dev/null ; then
echo "Aborting: Nix is already installed at $(type -p nix)" echo "Aborting: Nix is already installed at $(type -p nix)"
exit exit