lib/autoupdate: don't switch back to configurations without autoupdate
This commit is contained in:
parent
bffad63d96
commit
7855552e06
|
@ -12,6 +12,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.c3d2.autoUpdate {
|
config = lib.mkIf config.c3d2.autoUpdate {
|
||||||
|
# the presence of this file signifies that the system is
|
||||||
|
# autoupdate-enabled. it is checked to prevent autoupdating back
|
||||||
|
# to a system without autoupdate when deploying with autoupdate
|
||||||
|
# for the first time.
|
||||||
|
environment.etc."autoupdated".text = "";
|
||||||
|
|
||||||
systemd.services.autoupdate = {
|
systemd.services.autoupdate = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = with pkgs; [ nixFlakes nettools curl jq ];
|
path = with pkgs; [ nixFlakes nettools curl jq ];
|
||||||
|
@ -28,8 +34,12 @@
|
||||||
echo "New system available: $NEW"
|
echo "New system available: $NEW"
|
||||||
# this should fetch the new system from the binary cache
|
# this should fetch the new system from the binary cache
|
||||||
nix build --no-link "$NEW"
|
nix build --no-link "$NEW"
|
||||||
|
if [ -e "$NEW/sw/etc/autoupdated" ]; then
|
||||||
# switch to the new system
|
# switch to the new system
|
||||||
"$NEW/bin/switch-to-configuration" switch
|
"$NEW/bin/switch-to-configuration" switch
|
||||||
|
else
|
||||||
|
echo "New system is not yet autoupdated"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "No update required"
|
echo "No update required"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user