summary refs log tree commit diff
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2022-02-13 16:25:24 +0100
committerobadz <3359345+obadz@users.noreply.github.com>2022-03-04 13:04:24 +0000
commit2e46cc1f00cd965cef074d655b3813832c71a745 (patch)
tree461d19d5a372dc0de258aa1be310461ba1bcac9f
parentc738e61a9491674bf19cfb540d6756c8c227ad21 (diff)
downloadnixpkgs-2e46cc1f00cd965cef074d655b3813832c71a745.tar
nixpkgs-2e46cc1f00cd965cef074d655b3813832c71a745.tar.gz
nixpkgs-2e46cc1f00cd965cef074d655b3813832c71a745.tar.bz2
nixpkgs-2e46cc1f00cd965cef074d655b3813832c71a745.tar.lz
nixpkgs-2e46cc1f00cd965cef074d655b3813832c71a745.tar.xz
nixpkgs-2e46cc1f00cd965cef074d655b3813832c71a745.tar.zst
nixpkgs-2e46cc1f00cd965cef074d655b3813832c71a745.zip
nixos/earlyoom: remove useKernelOOMKiller
This option is deprecated and ignored by earlyoom since 1.2.
-rw-r--r--nixos/modules/services/system/earlyoom.nix35
1 files changed, 15 insertions, 20 deletions
diff --git a/nixos/modules/services/system/earlyoom.nix b/nixos/modules/services/system/earlyoom.nix
index 452efc73643..b355df056bc 100644
--- a/nixos/modules/services/system/earlyoom.nix
+++ b/nixos/modules/services/system/earlyoom.nix
@@ -39,20 +39,12 @@ in
         '';
       };
 
-      useKernelOOMKiller= mkOption {
-        type = types.bool;
-        default = false;
-        description = ''
-          Use kernel OOM killer instead of own user-space implementation.
-        '';
-      };
-
+      # TODO: remove or warn after 1.7 (https://github.com/rfjakob/earlyoom/commit/7ebc4554)
       ignoreOOMScoreAdjust = mkOption {
         type = types.bool;
         default = false;
         description = ''
           Ignore oom_score_adjust values of processes.
-          User-space implementation only.
         '';
       };
 
@@ -87,16 +79,21 @@ in
     };
   };
 
+  imports = [
+    (mkRemovedOptionModule [ "services" "earlyoom" "useKernelOOMKiller" ] ''
+      This option is deprecated and ignored by earlyoom since 1.2.
+    '')
+  ];
+
   config = mkIf ecfg.enable {
     assertions = [
       { assertion = ecfg.freeMemThreshold > 0 && ecfg.freeMemThreshold <= 100;
         message = "Needs to be a positive percentage"; }
       { assertion = ecfg.freeSwapThreshold > 0 && ecfg.freeSwapThreshold <= 100;
         message = "Needs to be a positive percentage"; }
-      { assertion = !ecfg.useKernelOOMKiller || !ecfg.ignoreOOMScoreAdjust;
-        message = "Both options in conjunction do not make sense"; }
     ];
 
+    # TODO: reimplement this option as -N after 1.7 (https://github.com/rfjakob/earlyoom/commit/afe03606)
     warnings = optional (ecfg.notificationsCommand != null)
       "`services.earlyoom.notificationsCommand` is deprecated and ignored by earlyoom since 1.6.";
 
@@ -107,15 +104,13 @@ in
       serviceConfig = {
         StandardOutput = "null";
         StandardError = "journal";
-        ExecStart = ''
-          ${pkgs.earlyoom}/bin/earlyoom \
-          -m ${toString ecfg.freeMemThreshold} \
-          -s ${toString ecfg.freeSwapThreshold} \
-          ${optionalString ecfg.useKernelOOMKiller "-k"} \
-          ${optionalString ecfg.ignoreOOMScoreAdjust "-i"} \
-          ${optionalString ecfg.enableDebugInfo "-d"} \
-          ${optionalString ecfg.enableNotifications "-n"}
-        '';
+        ExecStart = concatStringsSep " " ([
+          "${pkgs.earlyoom}/bin/earlyoom"
+          "-m ${toString ecfg.freeMemThreshold}"
+          "-s ${toString ecfg.freeSwapThreshold}"
+        ] ++ optional ecfg.ignoreOOMScoreAdjust "-i"
+          ++ optional ecfg.enableDebugInfo "-d"
+          ++ optional ecfg.enableNotifications "-n");
       };
     };