all: toggle system update based off status of the tree

Dirty means we are doing development on something so don't autoUpgrade
the changes away.
This commit is contained in:
Aaron Bieber 2022-11-04 07:23:28 -06:00
parent 734685410b
commit 8a23bd37e8
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View File

@ -76,7 +76,15 @@
flakes.taskobs.overlay
];
buildVer = { system.configurationRevision = self.rev or "DIRTY"; };
# Set our configurationRevison based on the status of our git repo.
# If the repo is dirty, disable autoUpgrade as it means we are
# testing something.
buildVer = let state = self.rev or "DIRTY";
in {
system.configurationRevision = state;
system.autoUpgrade.enable = (state != "DIRTY");
};
buildShell = pkgs:
pkgs.mkShell {
shellHook = ''

View File

@ -14,7 +14,8 @@ with lib; {
config = mkMerge [
(mkIf config.autoUpdate.enable {
system.autoUpgrade = {
enable = true;
# enable is set in flake depending on the state of the tree
# DIRTY means disabled, git revision means enabled
allowReboot = mkDefault false;
flake = "github:qbit/xin";
dates = "*-*-* *:05:00";