Add ZRAM module and enable it in core defaults
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
./virtualbox.nix
|
||||
./xdg.nix
|
||||
./xserver.nix
|
||||
./zram.nix
|
||||
inputs.stylix.nixosModules.stylix
|
||||
];
|
||||
}
|
||||
|
||||
32
modules/core/zram.nix
Normal file
32
modules/core/zram.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{pkgs, ...}: {
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
priority = 5;
|
||||
memoryMax = 16 * 1024 * 1024 * 1024;
|
||||
algorithm = "zstd";
|
||||
swapDevices = 1;
|
||||
memoryPercent = 50;
|
||||
};
|
||||
boot = {
|
||||
kernelParams = [
|
||||
"zswap.enabled=1" # enables zswap
|
||||
"zswap.compressor=zstd" # compression algorithm
|
||||
"zswap.max_pool_percent=20" # maximum percentage of RAM that zswap is allowed to use
|
||||
"zswap.shrinker_enabled=1" # whether to shrink the pool proactively on high memory pressure
|
||||
];
|
||||
tmp = {
|
||||
useZram = true;
|
||||
zramSettings = {
|
||||
compression-algorithm = "zstd";
|
||||
zram-size = "ram * 0.5";
|
||||
fs-type = "ext4";
|
||||
options = "X-mount.mode=1777,discard";
|
||||
};
|
||||
};
|
||||
};
|
||||
services.zram-generator = {
|
||||
enable = true;
|
||||
package = pkgs.zram-generator;
|
||||
settings = {};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user