summary refs log tree commit diff
path: root/nixos/modules/system/boot/systemd.nix
diff options
context:
space:
mode:
authorMatt Layher <mdlayher@gmail.com>2020-07-08 21:43:12 -0400
committerMatt Layher <mdlayher@gmail.com>2020-07-08 21:43:12 -0400
commitf9ea9c7299b9e5a181a7a99990d14ae069609eb1 (patch)
tree4436f646252275321103f823b2652093aca3c718 /nixos/modules/system/boot/systemd.nix
parentcb330dafd585849af115509b84eac482d2556375 (diff)
downloadnixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.gz
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.bz2
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.lz
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.xz
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.tar.zst
nixpkgs-f9ea9c7299b9e5a181a7a99990d14ae069609eb1.zip
nixos/systemd: add options for hardware watchdog management
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r--nixos/modules/system/boot/systemd.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index a8e51fc0901..020cf38ea3f 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -818,6 +818,45 @@ in
       '';
     };
 
+    systemd.watchdog.device = mkOption {
+      type = types.path;
+      example = "/dev/watchdog";
+      description = ''
+        The path to a hardware watchdog device which will be managed by systemd.
+        If not specified, systemd will default to /dev/watchdog.
+      '';
+    };
+
+    systemd.watchdog.runtimeTime = mkOption {
+      type = types.str;
+      example = "30s";
+      description = ''
+        The amount of time which can elapse before a watchdog hardware device
+        will automatically reboot the system. Valid time units include "ms",
+        "s", "min", "h", "d", and "w".
+      '';
+    };
+
+    systemd.watchdog.rebootTime = mkOption {
+      type = types.str;
+      example = "10m";
+      description = ''
+        The amount of time which can elapse after a reboot has been triggered
+        before a watchdog hardware device will automatically reboot the system.
+        Valid time units include "ms", "s", "min", "h", "d", and "w".
+      '';
+    };
+
+    systemd.watchdog.kexecTime = mkOption {
+      type = types.str;
+      example = "10m";
+      description = ''
+        The amount of time which can elapse when kexec is being executed before
+        a watchdog hardware device will automatically reboot the system. This
+        option should only be enabled if reloadTime is also enabled. Valid
+        time units include "ms", "s", "min", "h", "d", and "w".
+      '';
+    };
   };
 
 
@@ -889,6 +928,19 @@ in
           DefaultIPAccounting=yes
         ''}
         DefaultLimitCORE=infinity
+        ${optionalString (config.systemd.watchdog.device != "") ''
+          WatchdogDevice=${config.systemd.watchdog.device}
+        ''}
+        ${optionalString (config.systemd.watchdog.runtimeTime != "") ''
+          RuntimeWatchdogSec=${config.systemd.watchdog.runtimeTime}
+        ''}
+        ${optionalString (config.systemd.watchdog.rebootTime != "") ''
+          RebootWatchdogSec=${config.systemd.watchdog.rebootTime}
+        ''}
+        ${optionalString (config.systemd.watchdog.kexecTime != "") ''
+          KExecWatchdogSec=${config.systemd.watchdog.kexecTime}
+        ''}
+
         ${config.systemd.extraConfig}
       '';