nix: fix installing Nix

we didn't source profile after running nix/scripts/setup.sh

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-05-04 18:32:47 +02:00
parent d35deefcb5
commit 3116b04a34
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 9 additions and 2 deletions

View File

@ -4,18 +4,25 @@
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel) GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
# Location of profile script for Nix that adjusts PATH
NIX_PROFILE_SH="${HOME}/.nix-profile/etc/profile.d/nix.sh"
function source_nix() { function source_nix() {
# Just stop if Nix is already available # Just stop if Nix is already available
if [[ -x $(command -v nix) ]]; then if [[ -x $(command -v nix) ]]; then
return return
elif [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]]; then elif [[ -f "${NIX_PROFILE_SH}" ]]; then
# Load Nix profile if it exists # Load Nix profile if it exists
source "${HOME}/.nix-profile/etc/profile.d/nix.sh" source "${NIX_PROFILE_SH}"
return
else else
# Setup Nix if not available # Setup Nix if not available
${GIT_ROOT}/nix/scripts/setup.sh ${GIT_ROOT}/nix/scripts/setup.sh
fi fi
# Load Nix profile
source "${NIX_PROFILE_SH}"
# Verify Nix is available # Verify Nix is available
if [[ ! -x $(command -v nix) ]]; then if [[ ! -x $(command -v nix) ]]; then
echo "Nix not available, sourcing profile failed!" > /dev/stderr echo "Nix not available, sourcing profile failed!" > /dev/stderr