From c9ded32d122f63a180dd63a2b8cac3bf218d4511 Mon Sep 17 00:00:00 2001 From: Antoine Viallon Date: Thu, 11 Dec 2025 00:47:40 +0100 Subject: [PATCH] [General] use zram instead of zswap --- general.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/general.nix b/general.nix index 57b3b12..2f46c9a 100644 --- a/general.nix +++ b/general.nix @@ -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;