about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorwedens <kirill.wedens@gmail.com>2019-01-05 19:26:12 +0700
committerwedens <kirill.wedens@gmail.com>2019-01-08 22:14:48 +0700
commit5798d12842e7bad4f692d13f9631d656ee32fe9c (patch)
tree106bb412ecd740500dbb30cb2af32b5d2a599213 /nixos/modules/services
parent9acc5d9b4528b6ce3e965ceec781339927e3a319 (diff)
downloadnixlib-5798d12842e7bad4f692d13f9631d656ee32fe9c.tar
nixlib-5798d12842e7bad4f692d13f9631d656ee32fe9c.tar.gz
nixlib-5798d12842e7bad4f692d13f9631d656ee32fe9c.tar.bz2
nixlib-5798d12842e7bad4f692d13f9631d656ee32fe9c.tar.lz
nixlib-5798d12842e7bad4f692d13f9631d656ee32fe9c.tar.xz
nixlib-5798d12842e7bad4f692d13f9631d656ee32fe9c.tar.zst
nixlib-5798d12842e7bad4f692d13f9631d656ee32fe9c.zip
nixos/earlyoom: add notificationsCommand option
Add option for specifying command that will be used for sending notifications.
See https://github.com/rfjakob/earlyoom#notifications for details.
Diffstat (limited to 'nixos/modules/services')
-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}"}
         '';
       };
     };