diff --git a/test/installer.nix b/test/installer.nix index 4b3ec85939ca..2f8963a443b2 100644 --- a/test/installer.nix +++ b/test/installer.nix @@ -6,12 +6,17 @@ genericSubstituter { dir = "bin"; isExecutable = true; inherit shell nix; - + nixClosure = stdenv.mkDerivation { name = "closure"; - builder = builtins.toFile "builder.sh" - "source $stdenv/setup; nix-store -qR $nix > $out"; - buildInputs = [nix]; - inherit nix; + exportReferencesGraph = ["refs" nix]; + builder = builtins.toFile "builder.sh" " + source $stdenv/setup + if ! test -e refs; then + echo 'Your Nix installation is too old!' + exit 1 + fi + cp refs $out + "; }; } diff --git a/test/installer.sh b/test/installer.sh index c5dcecf20645..4abad8e38409 100644 --- a/test/installer.sh +++ b/test/installer.sh @@ -73,9 +73,21 @@ mkdir -m 0755 -p \ $mountPoint/nix/var/log/nix/drvs +# Get the store paths to copy from the references graph. +storePaths="" +while read storePath; do + storePaths="$storePaths $storePath" + read deriver + read count + for ((i = 0; i < $count; i++)); do + read ref + done +done < @nixClosure@ + + # Copy Nix to the Nix store on the target device. echo "copying Nix to $targetDevice...." -for i in $(cat @nixClosure@); do +for i in $storePaths; do echo " $i" rsync -a $i $mountPoint/nix/store/ done @@ -86,12 +98,7 @@ done # something. (I.e., Nix will see that, e.g., the glibc path is not # valid, delete it to get it out of the way, but as a result nothing # will work anymore.) -for i in $(cat @nixClosure@); do - echo $i - echo # deriver - echo 0 # nr of references -done \ -| chroot $mountPoint @nix@/bin/nix-store --register-validity +chroot $mountPoint @nix@/bin/nix-store --register-validity < @nixClosure@ # Create the required /bin/sh symlink; otherwise lots of things