* Use `exportReferencesGraph' to register the references of the

initial Nix installation correctly.

svn path=/nixu/trunk/; revision=7021
This commit is contained in:
Eelco Dolstra 2006-11-13 19:01:39 +00:00
parent 91a66e72dc
commit 82ce465751
2 changed files with 24 additions and 12 deletions

View File

@ -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
";
};
}

View File

@ -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