about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2022-12-09 19:57:44 +0100
committerGitHub <noreply@github.com>2022-12-09 19:57:44 +0100
commit2ee8b6ee742ac90351fd63c3559f73bdb83e232f (patch)
tree6d3fb0cd5c564de78b528fb06abb2e7c1ac3b5b2 /nixos/modules/config
parentfcd3ae431718432968f27c7f8e3160e0c0229950 (diff)
parentbe07c1bad9f639b1e739eaa94605d939efe759b5 (diff)
Merge pull request #188958 from lheckemann/zram-builtin
nixos/zram: support built-in zram
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/zram.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/config/zram.nix b/nixos/modules/config/zram.nix
index cc2ca63144332..87ac53a60b7ed 100644
--- a/nixos/modules/config/zram.nix
+++ b/nixos/modules/config/zram.nix
@@ -132,6 +132,8 @@ in
       options zram num_devices=${toString cfg.numDevices}
     '';
 
+    boot.kernelParams = ["zram.num_devices=${toString cfg.numDevices}"];
+
     services.udev.extraRules = ''
       KERNEL=="zram[0-9]*", ENV{SYSTEMD_WANTS}="zram-init-%k.service", TAG+="systemd"
     '';
@@ -178,9 +180,9 @@ in
           serviceConfig = {
             Type = "oneshot";
             RemainAfterExit = true;
-            ExecStartPre = "${modprobe} -r zram";
-            ExecStart = "${modprobe} zram";
-            ExecStop = "${modprobe} -r zram";
+            ExecStartPre = "-${modprobe} -r zram";
+            ExecStart = "-${modprobe} zram";
+            ExecStop = "-${modprobe} -r zram";
           };
           restartTriggers = [
             cfg.numDevices