Generate binary tarballs for installing Nix
For several platforms we don't currently have "native" Nix packages (e.g. Mac OS X and FreeBSD). This provides the next best thing: a tarball containing the closure of Nix, plus a simple script "nix-finish-install" that initialises the Nix database, registers the paths in the closure as valid, and runs "nix-env -i /path/to/nix" to initialise the user profile. The tarball must be unpacked in the root directory. It creates /nix/store/... and /usr/bin/nix-finish-install. Typical installation is as follows: $ cd / $ tar xvf /path/to/nix-1.1pre1234_abcdef-x86_64-linux.tar.bz2 $ nix-finish-install (if necessary add ~/.nix-profile/etc/profile.d/nix.sh to the shell login scripts) After this, /usr/bin/nix-finish-install can be deleted, if desired. The downside to the binary tarball is that it's pretty big (~55 MiB for x86_64-linux).
This commit is contained in:
parent
591aab7e21
commit
6814b1dfa1
2 changed files with 68 additions and 1 deletions
34
scripts/install-nix-from-closure.sh
Normal file
34
scripts/install-nix-from-closure.sh
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue