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-05-09 17:08:43 +02:00
|
|
|
#nix-channel --add http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable
|
2008-01-07 23:24:00 +01:00
|
|
|
#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
|
2008-06-05 17:33:17 +02:00
|
|
|
CHECKOUT_BRANCH=${NIXOS##*/}
|
|
|
|
CHECKOUT_BRANCH=${CHECKOUT_BRANCH#nixos-}
|
|
|
|
CHECKOUT_BRANCH=branches/${CHECKOUT_BRANCH}
|
|
|
|
CHECKOUT_SUFFIX=-${CHECKOUT_BRANCH##*/}
|
2008-02-08 20:13:29 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "${CHECKOUT_BRANCH}" && test -z "${CHECKOUT_SUFFIX}" ; then
|
2008-06-05 17:33:17 +02:00
|
|
|
CHECKOUT_SUFFIX=-${CHECKOUT_BRANCH##*/}
|
2008-02-08 20:13:29 +01:00
|
|
|
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
|
2008-03-04 00:31:48 +01:00
|
|
|
|
|
|
|
REVISION=$(svn info nixpkgs${CHECKOUT_SUFFIX} | egrep '^Revision: ');
|
|
|
|
REVISION=${REVISION#Revision: };
|
|
|
|
echo "\"$REVISION\"" > version.nix
|