services.earlyoom.killHook

NixOS option

null or absolute path

An absolute path to an executable to be run for each process killed. Some environment variables are available, see README and the man page for details. WARNING: earlyoom is running in a sandbox with ProtectSystem=“strict” by default, so filesystem write is also prohibited for the hook. If you want to change these protection rules, override the systemd service via systemd.services.earlyoom.serviceConfig.ProtectSystem.

type: null or absolute path
Default
null
Example
pkgs.writeShellScript "earlyoom-kill-hook" ''
  echo "Process $EARLYOOM_NAME ($EARLYOOM_PID) was killed" >> /path/to/log
''
declared in: nixos/modules/services/system/earlyoom.nixView source on NixOS/nixpkgs →