From 241b28d1014d94ba765e08a6e3209c24140570a8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 23 Jan 2007 17:17:10 +0000 Subject: [PATCH] * Register everything in the Nix store on the installation CD as a substitute to speed up installation. svn path=/nixos/trunk/; revision=7783 --- helpers/paths-from-graph.pl | 4 +++- installer/nixos-installer.sh | 18 +++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/helpers/paths-from-graph.pl b/helpers/paths-from-graph.pl index a5ef9c63916..bede974cb76 100644 --- a/helpers/paths-from-graph.pl +++ b/helpers/paths-from-graph.pl @@ -1,4 +1,5 @@ use strict; +use File::Basename; my %storePaths; my %refs; @@ -33,9 +34,10 @@ if ($ENV{"printManifest"} eq "1") { print "}\n"; foreach my $storePath (sort (keys %storePaths)) { + my $base = basename $storePath; print "localPath {\n"; print " StorePath: $storePath\n"; - print " CopyFrom: /tmp/inst-store$storePath\n"; + print " CopyFrom: /tmp/inst-store/$base\n"; print " References: "; foreach my $ref (@{$refs{$storePath}}) { print "$ref "; diff --git a/installer/nixos-installer.sh b/installer/nixos-installer.sh index 16797ea6c32..0032cce3507 100644 --- a/installer/nixos-installer.sh +++ b/installer/nixos-installer.sh @@ -113,20 +113,24 @@ mkdir -m 0755 -p $mountPoint/etc cp /etc/resolv.conf $mountPoint/etc/ +# Pull the manifest on the CD so that everything in the Nix store on +# the CD can be copied directly. +echo "registering substitutes to speed up builds..." +chroot $mountPoint @nix@/bin/nix-store --clear-substitutes +chroot $mountPoint @nix@/bin/nix-pull /mnt/MANIFEST +rm -f $mountPoint/tmp/inst-store +ln -s /mnt/nix/store $mountPoint/tmp/inst-store + + # Do a nix-pull to speed up building. if test -n "@nixpkgsURL@"; then - chroot $mountPoint @nix@/bin/nix-pull @nixpkgsURL@/MANIFEST + chroot $mountPoint @nix@/bin/nix-pull @nixpkgsURL@/MANIFEST || true fi # Build the specified Nix expression in the target store and install # it into the system configuration profile. - -#rm -rf $mountPoint/scratch -#mkdir $mountPoint/scratch -#curl $nixpkgsURL/nixexprs.tar.bz2 | tar xj -C $mountPoint/scratch -#nixpkgsName=$(cd $mountPoint/scratch && ls) - +echo "building the system configuration..." chroot $mountPoint @nix@/bin/nix-env \ -p /nix/var/nix/profiles/system \ -f "/mnt$nixosDir/system/system.nix" \