Skip to content

Commit

Permalink
nix: fix installing Nix
Browse files Browse the repository at this point in the history
we didn't source profile after running nix/scripts/setup.sh

Signed-off-by: Jakub Sokołowski <[email protected]>
  • Loading branch information
jakubgs committed May 4, 2020
1 parent d35deef commit 3116b04
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nix/scripts/source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@

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() {
# Just stop if Nix is already available
if [[ -x $(command -v nix) ]]; then
return
elif [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]]; then
elif [[ -f "${NIX_PROFILE_SH}" ]]; then
# Load Nix profile if it exists
source "${HOME}/.nix-profile/etc/profile.d/nix.sh"
source "${NIX_PROFILE_SH}"
return
else
# Setup Nix if not available
${GIT_ROOT}/nix/scripts/setup.sh
fi

# Load Nix profile
source "${NIX_PROFILE_SH}"

# Verify Nix is available
if [[ ! -x $(command -v nix) ]]; then
echo "Nix not available, sourcing profile failed!" > /dev/stderr
Expand Down

0 comments on commit 3116b04

Please sign in to comment.