diff --git a/hosts/flubber-machine/default.nix b/hosts/flubber-machine/default.nix index 10f6282..9078861 100755 --- a/hosts/flubber-machine/default.nix +++ b/hosts/flubber-machine/default.nix @@ -93,6 +93,7 @@ system.flatpak.enable = true; system.mpv.enable = true; system.ananicy.enable = true; + system.zswap.enable = true; system.kdeconnect.enable = true; # editors editors.micro.enable = true; diff --git a/modules/software/system/zswap.nix b/modules/software/system/zswap.nix new file mode 100644 index 0000000..3343827 --- /dev/null +++ b/modules/software/system/zswap.nix @@ -0,0 +1,20 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + 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" # lz4 is missing for some reason + "zswap.zpool=zsmalloc" + ]; + }; +}