about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorLassulus <github@lassul.us>2019-04-27 21:34:37 +0900
committerGitHub <noreply@github.com>2019-04-27 21:34:37 +0900
commit9cda3faecd7b4d936dc75d708aa88f4836b42154 (patch)
tree92544c34f591bc4ea24450dba1c1a27bab3f8b20 /nixos
parentc08aa32c906efe746fc1ffb2bdb0c5b9464d4a51 (diff)
parent5798d12842e7bad4f692d13f9631d656ee32fe9c (diff)
downloadnixlib-9cda3faecd7b4d936dc75d708aa88f4836b42154.tar
nixlib-9cda3faecd7b4d936dc75d708aa88f4836b42154.tar.gz
nixlib-9cda3faecd7b4d936dc75d708aa88f4836b42154.tar.bz2
nixlib-9cda3faecd7b4d936dc75d708aa88f4836b42154.tar.lz
nixlib-9cda3faecd7b4d936dc75d708aa88f4836b42154.tar.xz
nixlib-9cda3faecd7b4d936dc75d708aa88f4836b42154.tar.zst
nixlib-9cda3faecd7b4d936dc75d708aa88f4836b42154.zip
Merge pull request #53444 from wedens/earlyoom-notifications
nixos/earlyoom: add notificationsCommand option
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/system/earlyoom.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/services/system/earlyoom.nix b/nixos/modules/services/system/earlyoom.nix
index daa46838bfa8..39d1bf274bd2 100644
--- a/nixos/modules/services/system/earlyoom.nix
+++ b/nixos/modules/services/system/earlyoom.nix
@@ -63,6 +63,17 @@ in
           Enable debugging messages.
         '';
       };
+
+      notificationsCommand = mkOption {
+        type = types.nullOr types.str;
+        default = null;
+        example = "sudo -u example_user DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send";
+        description = ''
+          Command used to send notifications.
+
+          See <link xlink:href="https://github.com/rfjakob/earlyoom#notifications">README</link> for details.
+        '';
+      };
     };
   };
 
@@ -88,7 +99,9 @@ in
           -s ${toString ecfg.freeSwapThreshold} \
           ${optionalString ecfg.useKernelOOMKiller "-k"} \
           ${optionalString ecfg.ignoreOOMScoreAdjust "-i"} \
-          ${optionalString ecfg.enableDebugInfo "-d"}
+          ${optionalString ecfg.enableDebugInfo "-d"} \
+          ${optionalString (ecfg.notificationsCommand != null)
+            "-N ${escapeShellArg ecfg.notificationsCommand}"}
         '';
       };
     };