modules/autoupdate: always run nix-env before switch-to-configuration

This commit is contained in:
Astro 2022-09-02 21:26:14 +02:00
parent 8097c9a521
commit 5c493a8128

View File

@ -41,6 +41,7 @@
nix copy --from https://hydra.hq.c3d2.de "$NEW" nix copy --from https://hydra.hq.c3d2.de "$NEW"
if [ -e "$NEW/etc/systemd/system/autoupdate.timer" ]; then if [ -e "$NEW/etc/systemd/system/autoupdate.timer" ]; then
echo "Switch to the new system..." echo "Switch to the new system..."
nix-env -p /nix/var/nix/profiles/system --set $NEW
"$NEW/bin/switch-to-configuration" switch "$NEW/bin/switch-to-configuration" switch
else else
echo "New system is not yet autoupdate-enabled. Refusing to switch into a dead end." echo "New system is not yet autoupdate-enabled. Refusing to switch into a dead end."
@ -93,6 +94,7 @@
# this should fetch the new system from the binary cache # this should fetch the new system from the binary cache
nix copy --from https://hydra.hq.c3d2.de "$NEW" nix copy --from https://hydra.hq.c3d2.de "$NEW"
echo "Switch to the new system..." echo "Switch to the new system..."
nix-env -p /nix/var/nix/profiles/system --set $NEW
"$NEW/bin/switch-to-configuration" switch "$NEW/bin/switch-to-configuration" switch
else else
echo "No update required" echo "No update required"