From 49bf16698295cd068e125333ec2f7c7bfa6bda27 Mon Sep 17 00:00:00 2001 From: adikro Date: Mon, 22 Dec 2025 04:29:04 +0100 Subject: fixed the memory management module --- hosts/desktop/configuration.nix | 12 ++++++++---- hosts/laptop/configuration.nix | 12 ++++++++---- sys/core/memory.nix | 13 ++++--------- sys/core/storage.nix | 5 ++--- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 6f9b000..316a573 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -31,10 +31,14 @@ locale.enable = true; network.enable = true; memory = { - zram.enable = true; - zram.percent = 25; - swapfile.enable = true; - swapfile.size = 32; + zram = { + enable = true; + percent = 25; + }; + swapfile = { + enable = true; + size = 32; + }; }; security.enable = true; storage = { diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 3012da5..d9f458a 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -26,10 +26,14 @@ locale.enable = true; network.enable = true; memory = { - zram.enable = true; - zram.percent = 25; - swapfile.enable = true; - swapfile.size = 8; + zram = { + enable = true; + percent = 25; + }; + swapfile = { + enable = true; + size = 8; + }; }; power.enable = true; security.enable = true; diff --git a/sys/core/memory.nix b/sys/core/memory.nix index cdf71e8..956cc73 100644 --- a/sys/core/memory.nix +++ b/sys/core/memory.nix @@ -4,14 +4,11 @@ let in { options.sys.core.memory = { - enable = lib.mkEnableOption "memory management"; - zram = { enable = lib.mkEnableOption "enables zram compression"; percent = lib.mkOption { type = lib.types.int; default = 25; - description = "Percentage of total RAM to use for zram"; }; }; @@ -19,13 +16,11 @@ in enable = lib.mkEnableOption "enables a swapfile"; size = lib.mkOption { type = lib.types.int; - default = 8192; - description = "Size of the swapfile in gigabytes"; + default = 8; }; }; }; - - config = lib.mkIf cfg.enable (lib.mkMerge [ + config = lib.mkMerge [ (lib.mkIf cfg.zram.enable { zramSwap = { enable = true; @@ -38,9 +33,9 @@ in (lib.mkIf cfg.swapfile.enable { swapDevices = [ { device = "/.swapvol/swapfile"; - size = cfg.swapfile.size * 1024; + size = cfg.swapfile.size * 1024; priority = 0; } ]; }) - ]); + ]; } diff --git a/sys/core/storage.nix b/sys/core/storage.nix index d026eeb..693e5e7 100644 --- a/sys/core/storage.nix +++ b/sys/core/storage.nix @@ -24,9 +24,8 @@ in services.fstrim.enable = true; services.btrfs.autoScrub = { - enable = true; - interval = "monthly"; - fileSystems = [ "/" ]; + enable = true; + fileSystems = [ "/" ]; }; boot.tmp = { -- cgit v1.3