Move zram-swap to a module

This commit is contained in:
Andreas Zweili 2024-03-07 22:26:04 +01:00
parent 3c578a4a85
commit 507175582f
5 changed files with 29 additions and 15 deletions

View File

@ -54,5 +54,6 @@
./services/telegram-notifications
./services/tlp
./services/virtualbox-guest
./services/zram-swap
];
}

View File

@ -0,0 +1,25 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.az-zram-swap;
in
{
options = {
services.az-ram-swap.enable = lib.mkEnableOption "Enable zram swap";
};
config = lib.mkIf cfg.enable {
zramSwap = {
enable = true;
priority = 100;
};
# Since we have "fast" swap, we can increase swappiness
boot.kernel.sysctl = {
"vm.swappiness" = 180;
};
};
}

View File

@ -62,11 +62,6 @@
networking.hostName = hostname;
zramSwap = {
enable = true;
priority = 100;
};
swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
hardware = {
@ -90,6 +85,7 @@
az-restic-client-desktop.enable = true;
az-tlp.enable = true;
az-x86.enable = true;
az-zram-swap.enable = true;
fstrim.enable = true; # Enable TRIM for SD cards
hardware.bolt.enable = true; # Enable Thunderbolt control
logind.lidSwitchExternalPower = "ignore";

View File

@ -9,11 +9,6 @@
};
};
zramSwap = {
enable = true;
priority = 100;
};
# Features
profiles.az-server.enable = true;
services = {
@ -27,6 +22,7 @@
tag = "management";
time = "23:30";
};
az-zram-swap.enable = true;
};
# Enable dictionaries
programs = {

View File

@ -9,11 +9,6 @@
};
};
zramSwap = {
enable = true;
priority = 100;
};
profiles.az-server.enable = true;
services = {
az-acme-base.enable = true;
@ -26,6 +21,7 @@
tag = "proxy";
time = "00:00";
};
az-zram-swap.enable = true;
nginx = {
commonHttpConfig = ''
# Add HSTS header with preloading to HTTPS requests.