]> git.scottworley.com Git - auto-upgrade-with-pinch/blobdiff - modules/auto-upgrade.nix
Remove the `abort` otherPackages option
[auto-upgrade-with-pinch] / modules / auto-upgrade.nix
index c52f0bce10ab6fa5ce6ba0c47114692290ed84b5..5f5fe3ad6dbc5918509c9762dd0368fb7e3329d2 100644 (file)
@@ -197,7 +197,7 @@ let
       sync
 
       # Install
       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
       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 = ''
       signingKeys = mkOption {
         type = types.listOf types.path;
         description = ''
@@ -281,6 +295,7 @@ in
     security.sudo.extraRules = lib.mkAfter [
       {
         groups = [ "users" ];
     security.sudo.extraRules = lib.mkAfter [
       {
         groups = [ "users" ];
+        runAs = "root";
         commands = [
           {
             command = "${auto-upgrade-script}";
         commands = [
           {
             command = "${auto-upgrade-script}";