From 178c2e8c116c0d472453a6b54770be717030477f Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 30 Mar 2024 21:14:13 -0400 Subject: [PATCH] add systemConfig.zramSwap.size option and set new defaults --- hosts/lavaridge/default.nix | 4 +++- hosts/mauville/default.nix | 5 ++++- hosts/petalburg/default.nix | 4 +++- hosts/rustboro/default.nix | 5 ++++- nixosModules/systemConfig/zramSwap/default.nix | 7 ++++++- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 9fca3441..71dd537b 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -28,7 +28,9 @@ systemConfig = { plymouth.enable = true; - zramSwap.enable = true; + zramSwap = { + enable = true; + }; }; desktopConfig = { diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index fb28f0a9..253bf149 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -27,7 +27,10 @@ }; systemConfig = { - zramSwap.enable = true; + zramSwap = { + enable = true; + size = 100; + }; }; homeLab.enable = true; diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index 2cb1cd34..9581c40a 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -83,7 +83,9 @@ in { systemConfig = { plymouth.enable = true; - zramSwap.enable = true; + zramSwap = { + enable = true; + }; }; apps = { diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index 79025e62..5e2f836b 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -19,7 +19,10 @@ systemConfig = { plymouth.enable = true; - zramSwap.enable = true; + zramSwap = { + enable = true; + size = 100; + }; }; desktopConfig = { diff --git a/nixosModules/systemConfig/zramSwap/default.nix b/nixosModules/systemConfig/zramSwap/default.nix index f50f2660..cba721a8 100644 --- a/nixosModules/systemConfig/zramSwap/default.nix +++ b/nixosModules/systemConfig/zramSwap/default.nix @@ -2,12 +2,17 @@ options = { systemConfig.zramSwap.enable = lib.mkEnableOption "Enables zram swap."; + systemConfig.zramSwap.size = lib.mkOption { + description = "Percent size of the zram swap."; + default = 50; + type = lib.types.int; + }; }; config = lib.mkIf config.systemConfig.zramSwap.enable { zramSwap = { enable = true; - memoryPercent = 25; + memoryPercent = config.systemConfig.zramSwap.size; }; }; }