Compare commits
	
		
			2 commits
		
	
	
		
			00bf70b29a
			...
			b1cd6018ba
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| b1cd6018ba | |||
| 5585164f1f | 
					 3 changed files with 17 additions and 0 deletions
				
			
		|  | @ -119,6 +119,7 @@ in | |||
|         gitPull = true; | ||||
|         gitDeploymentKeyFile = "/secrets/ssh_id_gitea_nixos_configuration"; | ||||
|         gitUser = "fruchti"; | ||||
|         rebootIgnoreUsersActive = [ "waldi" ]; | ||||
|     }; | ||||
| 
 | ||||
|     # systemd.services.nixos-upgrade.onFailure = lib.mkIf config.system.autoUpgrade.enable [ "status-email@%n.service" ]; | ||||
|  |  | |||
|  | @ -19,6 +19,7 @@ | |||
|             "Berthold" | ||||
|             "Ernesto" | ||||
|             "Emitter" | ||||
|             "Adelheid" | ||||
|         ]); | ||||
|         superClients = [ | ||||
|             config.networking.hostName | ||||
|  |  | |||
|  | @ -36,6 +36,13 @@ in | |||
|                 User used for the `git pull` operation (if `gitPull` is enabled). | ||||
|             ''; | ||||
|         }; | ||||
|         rebootIgnoreUsersActive = mkOption { | ||||
|             type = types.listOf types.str; | ||||
|             default = []; | ||||
|             description = mdDoc '' | ||||
|                 If reboots are allowed, active users will prohibit a reboot. Users listed here are ignored from that check. | ||||
|             ''; | ||||
|         }; | ||||
|     }; | ||||
| 
 | ||||
|     config = mkIf cfg.enable { | ||||
|  | @ -156,6 +163,14 @@ in | |||
|                 EOF | ||||
|                         )" | ||||
|                         activate_configuration="no" | ||||
| 
 | ||||
|                         # Check if any user sessions are open | ||||
|                         active_users=$(users | tr ' ' '\n' | sort | uniq | grep -vE '^(${concatStringsSep "|" cfg.rebootIgnoreUsersActive})$') | ||||
|                         if [ "$reboot_allowed" = "yes" ] && [ -n "$active_users" ] ; then | ||||
|                             reboot_allowed=no | ||||
|                             email_body="$(printf "%s\n%s\n%s" "$email_body" "The system cannot reboot since the following users are active:" "$active_users")" | ||||
|                         fi | ||||
| 
 | ||||
|                         if [ "$reboot_allowed" = "yes" ] && [ $exit_code -eq 0 ] ; then | ||||
|                             email_body="$(printf "%s\n%s" "$email_body" "The system will reboot now.")" | ||||
|                             do_reboot="yes" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue