From 055b48c798039558e2ffde83b589ef6856917bbf Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 11 Feb 2024 02:45:20 -0500 Subject: nixos/zram: init --- modules/nixos/traits/zram.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 modules/nixos/traits/zram.nix (limited to 'modules/nixos/traits/zram.nix') diff --git a/modules/nixos/traits/zram.nix b/modules/nixos/traits/zram.nix new file mode 100644 index 0000000..337137a --- /dev/null +++ b/modules/nixos/traits/zram.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + ... +}: let + cfg = config.traits.zram; +in { + options.traits.zram = { + enable = lib.mkEnableOption "zram setup & configuration"; + }; + + config = lib.mkIf cfg.enable { + # https://github.com/pop-os/default-settings/pull/163 + # https://wiki.archlinux.org/title/Zram#Multiple_zram_devices + boot.kernel.sysctl = { + "vm.swappiness" = 180; + "vm.watermark_boost_factor" = 0; + "vm.watermark_scale_factor" = 125; + "vm.page-cluster" = 0; + }; + + zramSwap.enable = true; + }; +} -- cgit v1.2.3