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{
4 config,
5 lib,
6 pkgs,
7 ...
8}:
9let
10
11 inherit (pkgs) das_watchdog;
12
13in
14{
15 ###### interface
16
17 options = {
18 services.das_watchdog.enable = lib.mkEnableOption "realtime watchdog";
19 };
20
21 ###### implementation
22
23 config = lib.mkIf config.services.das_watchdog.enable {
24 environment.systemPackages = [ das_watchdog ];
25 systemd.services.das_watchdog = {
26 description = "Watchdog to ensure a realtime process won't hang the machine";
27 after = [
28 "multi-user.target"
29 "sound.target"
30 ];
31 wantedBy = [ "multi-user.target" ];
32 serviceConfig = {
33 User = "root";
34 Type = "simple";
35 ExecStart = "${das_watchdog}/bin/das_watchdog";
36 RemainAfterExit = true;
37 };
38 };
39 };
40}