disko-install: only set NIX_STATE_DIR for load-db

We don't need to keep this env var around for the xargs invocation, only when running `nix-store --load-db`.
This commit is contained in:
Florian Klink 2024-05-14 23:58:23 +02:00 committed by mergify[bot]
parent d62af72c22
commit cb1d6fba69

View File

@ -233,13 +233,11 @@ main() {
# 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
mkdir -p "${mountPoint}/nix/store"
xargs cp --recursive --target "${mountPoint}/nix/store" < "${closure_info}/store-paths"
echo "Loading nix database" >&2
nix-store --load-db < "${closure_info}/registration"
unset NIX_STATE_DIR
NIX_STATE_DIR=${mountPoint}/nix/var/nix nix-store --load-db < "${closure_info}/registration"
fi
nixos-install --no-root-password --system "$nixos_system" --root "$mountPoint"