liminix-fork/modules/watchdog/default.nix

31 lines
817 B
Nix
Raw Permalink Normal View History

## Watchdog
##
## Enable hardware watchdog (for devices that support one) and
## feed it by checking the health of specified critical services.
## If the watchdog feeder stops, the device will reboot.
2023-09-02 18:28:40 +02:00
{ lib, pkgs, config, ...}:
let
inherit (lib) mkOption types;
inherit (pkgs) liminix;
in
{
options = {
system.service.watchdog = mkOption {
type = liminix.lib.types.serviceDefn;
};
};
config.system.service.watchdog = liminix.callService ./watchdog.nix {
watched = mkOption {
description = "services to watch";
type = types.listOf liminix.lib.types.service;
};
headStart = mkOption {
description = "delay in seconds before watchdog starts checking service health";
default = 60;
type = types.int;
};
};
config.kernel.config.WATCHDOG = "y";
}