Auto reboot after kernel changed
This commit is contained in:
parent
736208b9c1
commit
4ff347fe63
@ -50,6 +50,18 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.nixos-upgrade.serviceConfig.ExecStartPost = pkgs.writeScript "post-upgrade-check" ''
|
||||
#!${pkgs.stdenv.shell}
|
||||
current=$(readlink -f /run/current-system/kernel)
|
||||
booted=$(readlink -f /run/booted-system/kernel)
|
||||
if [ "$current" != "$booted" ]; then
|
||||
echo "kernel changed, reboot" | systemd-cat --identifier "post-upgrade-check";
|
||||
reboot
|
||||
else
|
||||
echo "same kernel, do not reboot" | systemd-cat --identifier "post-upgrade-check";
|
||||
fi
|
||||
'';
|
||||
|
||||
system.stateVersion = "18.09";
|
||||
system.autoUpgrade.enable = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user