]> git.scottworley.com Git - auto-upgrade-with-pinch/commitdiff
Allow more-gentle "boot" (instead of "switch") updates
authorScott Worley <scottworley@scottworley.com>
Sat, 25 Jul 2026 19:37:45 +0000 (12:37 -0700)
committerScott Worley <scottworley@scottworley.com>
Sat, 25 Jul 2026 19:37:45 +0000 (12:37 -0700)
Since 26.05, "switch" updates have become more violent, abruptly logging
out graphical sessions.  :(

modules/auto-upgrade.nix

index 7d2404cefb21183d7701854288d1c3b6fba35291..5f5fe3ad6dbc5918509c9762dd0368fb7e3329d2 100644 (file)
@@ -197,7 +197,7 @@ let
       sync
 
       # Install
-      hydrate ${config.system.build.nixos-rebuild}/bin/nixos-rebuild switch
+      hydrate ${config.system.build.nixos-rebuild}/bin/nixos-rebuild ${cfg.operation}
       sync
       while read user;do
         remove_arg=-r
@@ -237,6 +237,20 @@ in
         '';
       };
 
+      operation = lib.mkOption {
+        type = lib.types.enum [
+          "switch"
+          "boot"
+        ];
+        default = "switch";
+        example = "boot";
+        description = ''
+          Whether to run
+          `nixos-rebuild switch --upgrade` or run
+          `nixos-rebuild boot --upgrade`
+        '';
+      };
+
       signingKeys = mkOption {
         type = types.listOf types.path;
         description = ''