From 730683518cbdb0ab521938125d22247fc80dd3c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Tue, 11 Apr 2023 17:00:07 +0200 Subject: [PATCH] feat(system): add zram swap --- home-server.nix | 5 ----- system/common.nix | 2 +- system/zram.nix | 8 ++++++++ 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 system/zram.nix diff --git a/home-server.nix b/home-server.nix index a1880f6..3847689 100644 --- a/home-server.nix +++ b/home-server.nix @@ -39,11 +39,6 @@ in with builtins; { nixpkgs.config.allowUnfree = true; - # improve memory performance - zramSwap.enable = true; - zramSwap.algorithm = "zstd"; - zramSwap.memoryPercent = 150; - networking.domain = "home.felschr.com"; networking.firewall.allowedTCPPorts = [ 80 443 ]; diff --git a/system/common.nix b/system/common.nix index c78ab85..e018006 100644 --- a/system/common.nix +++ b/system/common.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: { - imports = [ ./i18n.nix ./nix.nix ./networking.nix ./hardened.nix ]; + imports = [ ./zram.nix ./i18n.nix ./nix.nix ./networking.nix ./hardened.nix ]; environment.systemPackages = with pkgs; [ wget curl openssl neovim ]; } diff --git a/system/zram.nix b/system/zram.nix new file mode 100644 index 0000000..277acd1 --- /dev/null +++ b/system/zram.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + zramSwap.enable = true; + zramSwap.memoryPercent = 100; + zramSwap.memoryMax = 16 * 1024 * 1024 * 1024; + boot.kernel.sysctl."vm.swappiness" = 100; +}