From c5729e91107cafabf2af4cb3f6500782fb56db6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Thu, 14 Oct 2021 13:21:13 -0500 Subject: [PATCH] If Nix profile environment exist, source it before installation check --- lib/install-nix.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/install-nix.sh b/lib/install-nix.sh index 9787881..eca7aa8 100755 --- a/lib/install-nix.sh +++ b/lib/install-nix.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash 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 echo "Aborting: Nix is already installed at $(type -p nix)" exit