[General] use zram instead of zswap

This commit is contained in:
Antoine Viallon 2025-12-11 00:47:40 +01:00
parent 5578d0595f
commit c9ded32d12
No known key found for this signature in database
GPG key ID: 955188C241E23A20

View file

@ -3,6 +3,8 @@ with lib;
let
cfg = config.aviallon.general;
desktopCfg = config.aviallon.desktop;
cmdline = config.aviallon.boot.cmdline;
zswapEnabled = if cmdline ? "zswap.enabled" then cmdline."zswap.enabled" == "Y" else false
in
{
imports = [
@ -117,12 +119,25 @@ in
aviallon.boot.cmdline = mkIf cfg.unsafeOptimizations {
mitigations = "off";
"zswap.enabled" = "Y";
#"zswap.enabled" = "Y";
"zswap.shrinker_enabled" = "Y";
"zswap.compressor" = "zstd";
"zswap.pool" = "zsmalloc";
};
assertions = [
{
assertion = zswapEnabled -> (!config.zramSwap.enable);
message = "If using zswap, you should disable zram, as both conflict with each other";
}
];
zramSwap = {
enable = !zswapEnabled;
priority = 1000;
memoryPercent = 50;
};
powerManagement.cpuFreqGovernor = mkDefault "schedutil";
environment.noXlibs = mkIf (cfg.minimal && (!desktopCfg.enable)) true;