packages: fix microvm-rebuild-*-local

again?
This commit is contained in:
Sandro - 2023-12-26 00:19:50 +01:00
parent dfff241257
commit aa1b19d964
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 4 additions and 9 deletions

View File

@ -97,6 +97,7 @@ lib.attrsets.mapAttrs
rebuildArg = "--flake ${self}#${name} ${overrideInputsArgs} --accept-flake-config";
hostConfig = self.nixosConfigurations."${name}".config;
declaredRunnerDrvPath = discardStringCtx hostConfig.microvm.declaredRunner.drvPath;
declaredRunnerOutPath = discardStringCtx hostConfig.microvm.declaredRunner.outPath;
toplevelDrvPath = discardStringCtx hostConfig.system.build.toplevel.drvPath;
toplevelOutPath = discardStringCtx hostConfig.system.build.toplevel.outPath;
# let /var/lib/microvm/*/flake point to the flake-update branch so that
@ -254,21 +255,15 @@ lib.attrsets.mapAttrs
exit 2
''}
${hostConfig.system.build.copyToServer} ${declaredRunnerDrvPath}
nix build -L --no-link ${declaredRunnerDrvPath}^*
${hostConfig.system.build.copyToServer} ${declaredRunnerOutPath}
${hostConfig.system.build.runOnServer} bash -e <<END
set -eou pipefail
hostname=\$(cat /etc/hostname)
if [[ "\$hostname" != ${name} ]]; then
echo "hostname of ${target} was expected to be ${name} but is \$hostname. Aborting to be safe..."
exit 2
fi
${createDirsCopyCurrent name}
ln -sfT ${hostConfig.microvm.declaredRunner} current
ln -sfT ${declaredRunnerOutPath} current
echo '${selfRef}' > flake
${createSymlinks name}
systemctl restart microvm@${name}.service