Load the Nix database registration too, and let the GC test pass.
This commit is contained in:
parent
bc81b59c5d
commit
6c13b984d4
@ -1,4 +1,4 @@
|
|||||||
{ runCommand, nix, jq, path }:
|
{ closureInfo, runCommand, nix, jq, path }:
|
||||||
let
|
let
|
||||||
map-squash = ./map-squash.nix;
|
map-squash = ./map-squash.nix;
|
||||||
|
|
||||||
@ -9,6 +9,7 @@ let
|
|||||||
exportReferencesGraph = [ "root" storeContents ];
|
exportReferencesGraph = [ "root" storeContents ];
|
||||||
NIX_PATH = "nixpkgs=${path}";
|
NIX_PATH = "nixpkgs=${path}";
|
||||||
outputs = [ "out" "manifest" ];
|
outputs = [ "out" "manifest" ];
|
||||||
|
closureInfo = closureInfo { rootPaths = storeContents; };
|
||||||
} ''
|
} ''
|
||||||
cat root | grep /nix/store | sort | uniq | jq -R . | jq -s . > paths.json
|
cat root | grep /nix/store | sort | uniq | jq -R . | jq -s . > paths.json
|
||||||
nix-build ${map-squash} --arg pathsJson ./paths.json
|
nix-build ${map-squash} --arg pathsJson ./paths.json
|
||||||
@ -18,12 +19,15 @@ let
|
|||||||
find "$f" -type f >> $out
|
find "$f" -type f >> $out
|
||||||
done
|
done
|
||||||
|
|
||||||
touch $manifest
|
mkdir $manifest
|
||||||
|
touch $manifest/squashes
|
||||||
for f in $(cat "$out"); do
|
for f in $(cat "$out"); do
|
||||||
prefix=$(echo "$f" | head -c20)
|
prefix=$(echo "$f" | head -c20)
|
||||||
suffix=$(echo "$f" | tail -c+21)
|
suffix=$(echo "$f" | tail -c+21)
|
||||||
echo "$prefix $suffix" >> $manifest
|
echo "$prefix $suffix" >> $manifest/squashes
|
||||||
done
|
done
|
||||||
|
|
||||||
|
cat $closureInfo/registration | gzip -9 > $manifest/registration.gz
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
mkSquashfsManifest
|
mkSquashfsManifest
|
||||||
|
|||||||
14
quickly.nix
14
quickly.nix
@ -46,13 +46,14 @@ in
|
|||||||
mkdir -p /mnt-root/nix/.squash
|
mkdir -p /mnt-root/nix/.squash
|
||||||
mkdir -p /mnt-root/nix/store
|
mkdir -p /mnt-root/nix/store
|
||||||
|
|
||||||
|
gunzip < /nix-store-squashes/registration.gz > /mnt-root/nix/registration
|
||||||
|
|
||||||
# the manifest splits the /nix/store/.... path with a " " to
|
# the manifest splits the /nix/store/.... path with a " " to
|
||||||
# prevent Nix from determining it depends on things.
|
# prevent Nix from determining it depends on things.
|
||||||
for f in $(cat /nix-store-isos | sed 's/ //'); do
|
for f in $(cat /nix-store-squashes/squashes | sed 's/ //'); do
|
||||||
prefix=$(basename "$(dirname "$f")")
|
prefix=$(basename "$(dirname "$f")")
|
||||||
suffix=$(basename "$f")
|
suffix=$(basename "$f")
|
||||||
dest="$prefix$suffix"
|
dest="$prefix$suffix"
|
||||||
echo "$dest"
|
|
||||||
mkdir "/mnt-root/nix/.squash/$dest"
|
mkdir "/mnt-root/nix/.squash/$dest"
|
||||||
mount -t squashfs -o loop "$f" "/mnt-root/nix/.squash/$dest"
|
mount -t squashfs -o loop "$f" "/mnt-root/nix/.squash/$dest"
|
||||||
(
|
(
|
||||||
@ -63,10 +64,6 @@ in
|
|||||||
rm "$f"
|
rm "$f"
|
||||||
set +x
|
set +x
|
||||||
done
|
done
|
||||||
|
|
||||||
ls -la /mnt-root/nix/store | grep system-nixos
|
|
||||||
ls -la /mnt-root/nix/store/*-nixos-system*/
|
|
||||||
ls -la /mnt-root/nix/store/*-nixos-system*/*
|
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -103,7 +100,7 @@ in
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
object = config.system.build.squashfsStore.manifest;
|
object = config.system.build.squashfsStore.manifest;
|
||||||
symlink = "/nix-store-isos";
|
symlink = "/nix-store-squashes";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}}/initrd";
|
}}/initrd";
|
||||||
@ -116,7 +113,8 @@ in
|
|||||||
''
|
''
|
||||||
# After booting, register the contents of the Nix store
|
# After booting, register the contents of the Nix store
|
||||||
# in the Nix database in the tmpfs.
|
# in the Nix database in the tmpfs.
|
||||||
${config.nix.package}/bin/nix-store --load-db < /nix/store/nix-path-registration
|
echo "Loading the Nix database"
|
||||||
|
${config.nix.package}/bin/nix-store --load-db < /nix/registration
|
||||||
|
|
||||||
# nixos-rebuild also requires a "system" profile and an
|
# nixos-rebuild also requires a "system" profile and an
|
||||||
# /etc/NIXOS tag.
|
# /etc/NIXOS tag.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user