From be07c1bad9f639b1e739eaa94605d939efe759b5 Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Sun, 23 Jan 2022 11:49:09 +0100 Subject: [PATCH] nixos/zram: support built-in zram --- nixos/modules/config/zram.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/modules/config/zram.nix b/nixos/modules/config/zram.nix index b162fbc311e3..cd7c735e244e 100644 --- a/nixos/modules/config/zram.nix +++ b/nixos/modules/config/zram.nix @@ -131,6 +131,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" ''; @@ -177,9 +179,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