1# A general watchdog for the linux operating system that should run in the
2# background at all times to ensure a realtime process won't hang the machine
3{ config, lib, pkgs, ... }:
4
5with lib;
6
7let
8
9 inherit (pkgs) das_watchdog;
10
11in {
12 ###### interface
13
14 options = {
15 services.das_watchdog.enable = mkEnableOption (lib.mdDoc "realtime watchdog");
16 };
17
18 ###### implementation
19
20 config = mkIf config.services.das_watchdog.enable {
21 environment.systemPackages = [ das_watchdog ];
22 systemd.services.das_watchdog = {
23 description = "Watchdog to ensure a realtime process won't hang the machine";
24 after = [ "multi-user.target" "sound.target" ];
25 wantedBy = [ "multi-user.target" ];
26 serviceConfig = {
27 User = "root";
28 Type = "simple";
29 ExecStart = "${das_watchdog}/bin/das_watchdog";
30 RemainAfterExit = true;
31 };
32 };
33 };
34}