mirror of
https://github.com/nix-community/disko.git
synced 2026-12-01 05:23:28 +01:00
load database with checksum again but do the same in disko-install
This commit is contained in:
1 parent
8a4585a200
commit
cdefe26742
7 files changed
+48
-60
No files matched your search
+20
-1
@@ -207,11 +207,13 @@ main() {
|
||||
--arg diskMappings "$(serialiaseArrayToNix diskMappings)" \
|
||||
--argstr extraSystemConfig "$extraSystemConfig" \
|
||||
-A installToplevel \
|
||||
-A closureInfo \
|
||||
-A "$diskoAttr")
|
||||
|
||||
IFS=$'\n' mapfile -t artifacts <<<"$outputs"
|
||||
nixos_system=${artifacts[0]}
|
||||
disko_script=${artifacts[1]}
|
||||
closure_info=${artifacts[1]}
|
||||
disko_script=${artifacts[2]}
|
||||
|
||||
if [[ -n ${dry_run-} ]]; then
|
||||
echo "Would run: $disko_script"
|
||||
@@ -227,6 +229,23 @@ main() {
|
||||
cp -ar "$source" "$mountPoint/$destination"
|
||||
done
|
||||
|
||||
# nix copy uses up a lot of memory and we work around issues with incorrect checksums in our store
|
||||
# that can be caused by using closureInfo in combination with multiple builders and non-deterministic builds.
|
||||
# Therefore if we have a blank store, we copy the store paths and registration from the closureInfo.
|
||||
if [[ ! -d "${mountPoint}/nix/store" ]]; then
|
||||
export NIX_STATE_DIR=${mountPoint}/nix/var/nix
|
||||
echo "Copying store paths" >&2
|
||||
|
||||
if [ -t 1 ]; then
|
||||
xargs -I% xcp --recursive % "${mountPoint}/nix/store" < "${closure_info}/store-paths"
|
||||
else
|
||||
xargs -I% xcp --recursive --no-progress % "${mountPoint}/nix/store" < "${closure_info}/store-paths"
|
||||
fi
|
||||
echo "Loading nix database" >&2
|
||||
nix-store --load-db < "${closure_info}/registration"
|
||||
unset NIX_STATE_DIR
|
||||
fi
|
||||
|
||||
nixos-install --no-root-password --system "$nixos_system" --root "$mountPoint"
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user