Properly update profile when not rebooting microvm
This commit is contained in:
parent
a8bde144b3
commit
75fe718992
10
packages.nix
10
packages.nix
|
@ -232,6 +232,10 @@ lib.attrsets.mapAttrs
|
|||
echo "hostname of ${target} was expected to be ${name} but is \$hostname. Aborting to be safe..."
|
||||
exit 2
|
||||
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-env -p /nix/var/nix/profiles/system --set ${toplevelOutPath}
|
||||
${toplevelOutPath}/bin/switch-to-configuration "''${@:-switch}"
|
||||
END
|
||||
# ^ yes, this is required to be like this
|
||||
|
@ -253,6 +257,12 @@ lib.attrsets.mapAttrs
|
|||
|
||||
${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
|
||||
|
|
Loading…
Reference in New Issue