diff options
Diffstat (limited to 'scripts/install-nix-from-closure.sh')
-rw-r--r-- | scripts/install-nix-from-closure.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/install-nix-from-closure.sh b/scripts/install-nix-from-closure.sh new file mode 100644 index 000000000000..41e596e5fffd --- /dev/null +++ b/scripts/install-nix-from-closure.sh @@ -0,0 +1,34 @@ +#! /bin/sh -e + +nix=@nix@ +regInfo=@regInfo@ + +if ! $nix/bin/nix-store --load-db < $regInfo; then + echo "$0: unable to register valid paths" + exit 1 +fi + +. @nix@/etc/profile.d/nix.sh + +if ! $nix/bin/nix-env -i @nix@; then + echo "$0: unable to install Nix into your default profile" + exit 1 +fi + +# Add nix.sh to the shell's profile.d directory. +p=$NIX_LINK/etc/profile.d/nix.sh + +if [ -w /etc/profile.d ]; then + ln -s $p /etc/profile.d/ +elif [ -w /usr/local/etc/profile.d ]; then + ln -s $p /usr/local/etc/profile.d/ +else + cat <<EOF +Installation finished. To ensure that the necessary environment +variables are set, please add the line + + source $p + +to your shell profile (e.g. ~/.profile). +EOF +fi \ No newline at end of file |