{ lib, config, pkgs, ... }: with lib; let # TODO: move this dawg cfg = config.modules.software.system.zswap; in { options.modules.software.system.zswap = { enable = mkEnableOption "Enable zswap, a compressed RAM cache for swap pages"; }; config = mkIf cfg.enable { boot.kernelParams = [ "zswap.enabled=1" "zswap.shrinker_enabled=1" # high mem: shrink zswap, mv to swap "zswap.max_pool_percent=20" # TODO: tune this (keep in mind shrinker is enabled) "zswap.compressor=zstd" "zswap.zpool=zsmalloc" ]; }; }