about summary refs log tree commit diff
path: root/nixos/modules/config/zram.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/config/zram.nix')
-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 cc2ca6314433..87ac53a60b7e 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