about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/system
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-06-04 10:19:13 +0000
committerAlyssa Ross <hi@alyssa.is>2020-06-04 22:45:31 +0000
commitda8562f302a145605a3270114ea7063daa82a173 (patch)
treeb27c6d509bad0ee5449f1fcf261a7ec3210df495 /nixpkgs/nixos/modules/services/system
parent17df60ef482ef52b2088e1913de9cd436320612a (diff)
parent467ce5a9f45aaf96110b41eb863a56866e1c2c3c (diff)
downloadnixlib-da8562f302a145605a3270114ea7063daa82a173.tar
nixlib-da8562f302a145605a3270114ea7063daa82a173.tar.gz
nixlib-da8562f302a145605a3270114ea7063daa82a173.tar.bz2
nixlib-da8562f302a145605a3270114ea7063daa82a173.tar.lz
nixlib-da8562f302a145605a3270114ea7063daa82a173.tar.xz
nixlib-da8562f302a145605a3270114ea7063daa82a173.tar.zst
nixlib-da8562f302a145605a3270114ea7063daa82a173.zip
Merge commit '467ce5a9f45aaf96110b41eb863a56866e1c2c3c'
Diffstat (limited to 'nixpkgs/nixos/modules/services/system')
-rw-r--r--nixpkgs/nixos/modules/services/system/earlyoom.nix23
-rw-r--r--nixpkgs/nixos/modules/services/system/nscd.conf2
2 files changed, 20 insertions, 5 deletions
diff --git a/nixpkgs/nixos/modules/services/system/earlyoom.nix b/nixpkgs/nixos/modules/services/system/earlyoom.nix
index 39d1bf274bd2..c6a001d30eeb 100644
--- a/nixpkgs/nixos/modules/services/system/earlyoom.nix
+++ b/nixpkgs/nixos/modules/services/system/earlyoom.nix
@@ -67,9 +67,19 @@ in
       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.
+          This option is deprecated and ignored by earlyoom since 1.6.
+          Use <option>services.earlyoom.enableNotifications</option> instead.
+        '';
+      };
+
+      enableNotifications = mkOption {
+        type = types.bool;
+        default = false;
+        description = ''
+          Send notifications about killed processes via the system d-bus.
+          To actually see the notifications in your GUI session, you need to have
+          <literal>systembus-notify</literal> running as your user.
 
           See <link xlink:href="https://github.com/rfjakob/earlyoom#notifications">README</link> for details.
         '';
@@ -87,9 +97,13 @@ in
         message = "Both options in conjunction do not make sense"; }
     ];
 
+    warnings = optional (ecfg.notificationsCommand != null)
+      "`services.earlyoom.notificationsCommand` is deprecated and ignored by earlyoom since 1.6.";
+
     systemd.services.earlyoom = {
       description = "Early OOM Daemon for Linux";
       wantedBy = [ "multi-user.target" ];
+      path = optional ecfg.enableNotifications pkgs.dbus;
       serviceConfig = {
         StandardOutput = "null";
         StandardError = "syslog";
@@ -100,10 +114,11 @@ in
           ${optionalString ecfg.useKernelOOMKiller "-k"} \
           ${optionalString ecfg.ignoreOOMScoreAdjust "-i"} \
           ${optionalString ecfg.enableDebugInfo "-d"} \
-          ${optionalString (ecfg.notificationsCommand != null)
-            "-N ${escapeShellArg ecfg.notificationsCommand}"}
+          ${optionalString ecfg.enableNotifications "-n"}
         '';
       };
     };
+
+    environment.systemPackages = optional ecfg.enableNotifications pkgs.systembus-notify;
   };
 }
diff --git a/nixpkgs/nixos/modules/services/system/nscd.conf b/nixpkgs/nixos/modules/services/system/nscd.conf
index 2b7523a7346d..722b883ba420 100644
--- a/nixpkgs/nixos/modules/services/system/nscd.conf
+++ b/nixpkgs/nixos/modules/services/system/nscd.conf
@@ -24,7 +24,7 @@ negative-time-to-live   netgroup        0
 shared                  netgroup        yes
 
 enable-cache            hosts           yes
-positive-time-to-live   hosts           600
+positive-time-to-live   hosts           0
 negative-time-to-live   hosts           0
 shared                  hosts           yes