misc modules

This commit is contained in:
blahai 2025-02-17 21:09:29 +02:00
parent 469c7f3651
commit 1397580971
Signed by: blahai
SSH key fingerprint: SHA256:ZfCryi+V64yG+vC1ZIIsqgvBCmA31tTi7RJ6M8CvpRc
3 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,6 @@
{
imports = [
./docs.nix
./zram.nix
];
}

View file

@ -0,0 +1,19 @@
{lib, ...}: let
inherit (lib.modules) mkForce;
inherit (lib.attrsets) mapAttrs;
in {
# we don't need docs where we're going!
documentation = mapAttrs (_: mkForce) {
enable = false;
dev.enable = false;
doc.enable = false;
info.enable = false;
nixos.enable = false;
man = {
enable = false;
generateCaches = false;
man-db.enable = false;
mandoc.enable = false;
};
};
}

View file

@ -0,0 +1,24 @@
{
lib,
config,
...
}: let
inherit (lib.modules) mkIf;
in {
# compress 3/4ths of ram to use as swap
# basically, get more memory per memory
zramSwap = {
enable = true;
algorithm = "zstd";
memoryPercent = 75; # defaults to 50
};
boot.kernel.sysctl = mkIf config.zramSwap.enable {
# zram is relatively cheap, prefer swap
"vm.swappiness" = 180;
"vm.watermark_boost_factor" = 0;
"vm.watermark_scale_factor" = 125;
# zram is in memory, no need to readahead
"vm.page-cluster" = 0;
};
}