2007-02-06 15:13:12 +01:00
|
|
|
#! @shell@ -e
|
|
|
|
set -x
|
|
|
|
|
2008-02-08 16:59:15 +01:00
|
|
|
# Pull the manifests defined in the configuration (the "manifests"
|
|
|
|
# attribute). Wonderfully hacky *and* cut&pasted from nixos-installer.sh!!!
|
|
|
|
if test -z "$NIXOS"; then NIXOS=/etc/nixos/nixos; fi
|
|
|
|
if test -z "$NIXOS_NO_PULL"; then
|
|
|
|
manifests=$(nix-instantiate --eval-only --xml --strict $NIXOS -A manifests \
|
|
|
|
| grep '<string' | sed 's^.*"\(.*\)".*^\1^g')
|
|
|
|
|
|
|
|
mkdir -p /nix/var/nix/channel-cache
|
|
|
|
for i in $manifests; do
|
|
|
|
NIX_DOWNLOAD_CACHE=/nix/var/nix/channel-cache nix-pull $i || true
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2007-02-06 15:13:12 +01:00
|
|
|
# Obtain Subversion.
|
2007-02-08 20:53:21 +01:00
|
|
|
if test -z "$(type -tp svn)"; then
|
2008-01-07 23:24:00 +01:00
|
|
|
#nix-channel --add http://nix.cs.uu.nl/dist/nix/channels-v3/nixpkgs-unstable
|
|
|
|
#nix-channel --update
|
2007-02-08 20:53:21 +01:00
|
|
|
nix-env -i subversion
|
|
|
|
fi
|
2007-02-06 15:13:12 +01:00
|
|
|
|
|
|
|
cd /etc/nixos
|
|
|
|
|
2008-02-08 20:13:29 +01:00
|
|
|
if test -n "$NIXOS" && test "$NIXOS_BRANCH" = 1 && test -z "$CHECKOUT_BRANCH" && ! test "$NIXOS" = "/etc/nixos/nixos"; then
|
|
|
|
CHECKOUT_BRANCH=${NIXOS##*/}
|
|
|
|
CHECKOUT_BRANCH=${CHECKOUT_BRANCH#nixos-}
|
|
|
|
CHECKOUT_BRANCH=branches/${CHECKOUT_BRANCH}
|
|
|
|
CHECKOUT_SUFFIX=-${CHECKOUT_BRANCH##*/}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "${CHECKOUT_BRANCH}" && test -z "${CHECKOUT_SUFFIX}" ; then
|
|
|
|
CHECKOUT_SUFFIX=-${CHECKOUT_BRANCH##*/}
|
|
|
|
fi;
|
|
|
|
|
2007-02-06 15:13:12 +01:00
|
|
|
# Move any old nixos or nixpkgs directories out of the way.
|
|
|
|
backupTimestamp=$(date "+%Y%m%d%H%M%S")
|
|
|
|
|
|
|
|
if test -e nixos -a ! -e nixos/.svn; then
|
2008-02-08 20:13:29 +01:00
|
|
|
mv nixos${CHECKOUT_SUFFIX} nixos-$backupTimestamp
|
2007-02-06 15:13:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -e nixpkgs -a ! -e nixpkgs/.svn; then
|
2008-02-08 20:13:29 +01:00
|
|
|
mv nixpkgs${CHECKOUT_SUFFIX} nixpkgs-$backupTimestamp
|
2007-02-06 15:13:12 +01:00
|
|
|
fi
|
|
|
|
|
2007-11-05 09:33:12 +01:00
|
|
|
if test -e services -a ! -e services/.svn; then
|
2007-06-18 22:33:30 +02:00
|
|
|
mv nixos/services services-$backupTimestamp
|
|
|
|
fi
|
|
|
|
|
2007-02-06 15:13:12 +01:00
|
|
|
# Check out the NixOS and Nixpkgs sources.
|
2008-04-25 22:28:39 +02:00
|
|
|
svn co https://svn.nixos.org/repos/nix/nixos/trunk nixos${CHECKOUT_SUFFIX}
|
|
|
|
svn co https://svn.nixos.org/repos/nix/nixpkgs/${CHECKOUT_BRANCH:-trunk} nixpkgs${CHECKOUT_SUFFIX}
|
|
|
|
svn co https://svn.nixos.org/repos/nix/services/trunk services
|
2007-02-06 15:13:12 +01:00
|
|
|
|
2008-01-30 02:28:56 +01:00
|
|
|
# Add a few required symlink.
|
2008-02-08 20:13:29 +01:00
|
|
|
ln -sfn ../services nixos${CHECKOUT_SUFFIX}/services
|
|
|
|
ln -sfn ../nixpkgs${CHECKOUT_SUFFIX}/pkgs nixos${CHECKOUT_SUFFIX}/pkgs
|
2008-03-04 00:31:48 +01:00
|
|
|
|
|
|
|
REVISION=$(svn info nixpkgs${CHECKOUT_SUFFIX} | egrep '^Revision: ');
|
|
|
|
REVISION=${REVISION#Revision: };
|
|
|
|
echo "\"$REVISION\"" > version.nix
|