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 {
|
||||
# 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 = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
path = with pkgs; [ nixFlakes nettools curl jq ];
|
||||
|
@ -28,8 +34,12 @@
|
|||
echo "New system available: $NEW"
|
||||
# this should fetch the new system from the binary cache
|
||||
nix build --no-link "$NEW"
|
||||
# switch to the new system
|
||||
"$NEW/bin/switch-to-configuration" switch
|
||||
if [ -e "$NEW/sw/etc/autoupdated" ]; then
|
||||
# switch to the new system
|
||||
"$NEW/bin/switch-to-configuration" switch
|
||||
else
|
||||
echo "New system is not yet autoupdated"
|
||||
fi
|
||||
else
|
||||
echo "No update required"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue