misc modules
This commit is contained in:
parent
469c7f3651
commit
1397580971
3 changed files with 49 additions and 0 deletions
6
modules/nixos/misc/default.nix
Normal file
6
modules/nixos/misc/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./docs.nix
|
||||
./zram.nix
|
||||
];
|
||||
}
|
19
modules/nixos/misc/docs.nix
Normal file
19
modules/nixos/misc/docs.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
24
modules/nixos/misc/zram.nix
Normal file
24
modules/nixos/misc/zram.nix
Normal 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;
|
||||
};
|
||||
}
|
Loading…
Add table
Reference in a new issue