nixos/zram: use nixos/zram-generator as backing implementation

This commit is contained in:
Nick Cao 2023-08-13 15:38:40 +08:00
parent a7e095d9fd
commit 0814089e05
No known key found for this signature in database

View File

@ -105,20 +105,9 @@ in
}
];
services.zram-generator.enable = true;
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isModule "ZRAM")
];
# Disabling this for the moment, as it would create and mkswap devices twice,
# once in stage 2 boot, and again when the zram-reloader service starts.
# boot.kernelModules = [ "zram" ];
systemd.packages = [ pkgs.zram-generator ];
systemd.services."systemd-zram-setup@".path = [ pkgs.util-linux ]; # for mkswap
environment.etc."systemd/zram-generator.conf".source =
(pkgs.formats.ini { }).generate "zram-generator.conf" (lib.listToAttrs
services.zram-generator.settings = lib.listToAttrs
(builtins.map
(dev: {
name = dev;
@ -134,7 +123,7 @@ in
writeback-device = cfg.writebackDevice;
};
})
devices));
devices);
};