Fix closureInfo copy

This commit is contained in:
Sandro - 2023-11-14 00:22:41 +01:00
parent 3528b38842
commit 3fc74479c3
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 7 additions and 4 deletions

View File

@ -202,16 +202,19 @@ lib.attrsets.mapAttrs
"microvm-update-${name}" = pkgs.writeScriptBin "microvm-update-${name}" (
if builtins.elem (hostConfig.c3d2.deployment.server or null) [ "server9" "server10" ]
then ''
then let
closureInfo = pkgs.closureInfo { rootPaths = [ hostConfig.system.build.toplevel.outPath ]; };
in ''
set -eou pipefail
${hostConfig.system.build.copyToServer} ${declaredRunnerDrvPath}
${hostConfig.system.build.copyToServer} ${declaredRunnerDrvPath} ${discardStringCtx closureInfo.drvPath}
${hostConfig.system.build.runOnServer} NIXOS_REBUILD="''${NIXOS_REBUILD:-}" bash -e <<END
set -eou pipefail
${createDirsCopyCurrent name}
nix build -L --accept-flake-config -o current ${declaredRunnerDrvPath}
nix build -L --accept-flake-config --no-link ${discardStringCtx closureInfo.drvPath}
echo '${selfRef}' > flake
${createSymlinks name}
@ -222,7 +225,7 @@ lib.attrsets.mapAttrs
fi
END
if [[ -n ''${NIXOS_REBUILD:-} ]]; then
if [[ -n \''${NIXOS_REBUILD:-} ]]; then
echo "Switching to configuration..."
ssh ${target} bash -e <<END
set -eou pipefail
@ -234,7 +237,7 @@ lib.attrsets.mapAttrs
fi
# refresh nix db which is required for nix-env -p ... --set
${discardStringCtx hostConfig.nix.package}/bin/nix-store --load-db < ${discardStringCtx (pkgs.closureInfo { rootPaths = [ hostConfig.system.build.toplevel.outPath ]; })}
${discardStringCtx hostConfig.nix.package}/bin/nix-store --load-db < ${discardStringCtx closureInfo}
${discardStringCtx hostConfig.nix.package}/bin/nix-env -p /nix/var/nix/profiles/system --set ${toplevelOutPath}
${toplevelOutPath}/bin/switch-to-configuration "''${@:-switch}"
END