Enable zramswap and earlyoom

This commit is contained in:
Artemis Tosini 2023-11-18 21:59:14 +00:00
parent 0fe4816359
commit 6d5a1145a8
Signed by: artemist
GPG key ID: EE5227935FE3FF18
8 changed files with 31 additions and 26 deletions

View file

@ -201,11 +201,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1699783872, "lastModified": 1700261686,
"narHash": "sha256-4zTwLT2LL45Nmo6iwKB3ls3hWodVP9DiSWxki/oewWE=", "narHash": "sha256-kplQg6hKFNuWKrOyGp9D//G/WH1nHGJ43r2m7fagTYY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "280721186ab75a76537713ec310306f0eba3e407", "rev": "ecd0a800f716b80a6eac58a7ac34d6d33e6fa5ee",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -265,11 +265,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1699701045, "lastModified": 1700315735,
"narHash": "sha256-mDzUXK7jNO/utInWpSWEX1NgEEunVIpJg+LyPsDTfy0=", "narHash": "sha256-zlSLW6dX5XwBEwN87CIVtMr8zDSKvTRFmWmIQ9FfWgo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "b689465d0c5d88e158e7d76094fca08cc0223aad", "rev": "1721da31f9b30cbf4460c4ec5068b3b6174a4694",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -280,11 +280,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1699099776, "lastModified": 1700204040,
"narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", "narHash": "sha256-xSVcS5HBYnD3LTer7Y2K8ZQCDCXMa3QUD1MzRjHzuhI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", "rev": "c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -338,11 +338,11 @@
"pre-commit-hooks": "pre-commit-hooks" "pre-commit-hooks": "pre-commit-hooks"
}, },
"locked": { "locked": {
"lastModified": 1699881763, "lastModified": 1700240304,
"narHash": "sha256-3oky/Ye5JPIsPj77A7XGXFkAlhAV70N1pGoEkfZKQyA=", "narHash": "sha256-nR5Ot2nN0msfGD1Vj76/4zb6+5ksJ28gfsit/BhK/oA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "d748d9ea024c0ebe99996f71a534d2ebb12e5462", "rev": "440c449c0a13f7864bb8406baf19f4e9f61abc55",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -436,11 +436,11 @@
}, },
"private": { "private": {
"locked": { "locked": {
"lastModified": 1699584232, "lastModified": 1700250258,
"narHash": "sha256-nVMcOMUtTKfdZZlp+DAp3NYsEXCGWwUpaAYAmyv+PkY=", "narHash": "sha256-5RE41KPIh85LRSwWP0CHBv2L5Gl1Qnl42268JE9fFWI=",
"ref": "unified", "ref": "unified",
"rev": "5248b9d52f4d73f4781d49dbc8e05d6b2fd1adae", "rev": "061bc7e341df4629220e215c6caad77684c18513",
"revCount": 37, "revCount": 38,
"type": "git", "type": "git",
"url": "ssh://gitea@git.mildlyfunctional.gay/artemist/nixos-config-private" "url": "ssh://gitea@git.mildlyfunctional.gay/artemist/nixos-config-private"
}, },

10
sets/swap.nix Normal file
View file

@ -0,0 +1,10 @@
{ lib, ... }: {
zramSwap = {
enable = true;
memoryPercent = lib.mkDefault 25;
};
services.earlyoom = {
enable = true;
freeMemThreshold = lib.mkDefault 5;
};
}

View file

@ -2,13 +2,14 @@
{ {
imports = [ imports = [
../home
./1password.nix ./1password.nix
./sway.nix ./base.nix
./nix-index.nix
./packages.nix ./packages.nix
./pipewire.nix ./pipewire.nix
./base.nix ./swap.nix
../home ./sway.nix
./nix-index.nix
inputs.nixvim.nixosModules.nixvim inputs.nixvim.nixosModules.nixvim
]; ];

View file

@ -2,7 +2,6 @@
{ {
boot = { boot = {
kernel.sysctl."vm.swappiness" = 5;
kernelParams = [ "console=tty1" ]; kernelParams = [ "console=tty1" ];
tmp.cleanOnBoot = true; tmp.cleanOnBoot = true;
loader.grub.enable = false; loader.grub.enable = false;

View file

@ -3,7 +3,6 @@
{ {
boot = { boot = {
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernel.sysctl."vm.swappiness" = 5;
tmp.cleanOnBoot = true; tmp.cleanOnBoot = true;
blacklistedKernelModules = [ "psmouse" ]; blacklistedKernelModules = [ "psmouse" ];

View file

@ -3,7 +3,6 @@
{ {
boot = { boot = {
kernelParams = [ "fbcon=rotate:1" ]; kernelParams = [ "fbcon=rotate:1" ];
kernel.sysctl."vm.swappiness" = 5;
tmp.cleanOnBoot = true; tmp.cleanOnBoot = true;
}; };

View file

@ -11,7 +11,6 @@ in {
boot = { boot = {
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
kernel.sysctl."vm.swappiness" = 5;
tmp.cleanOnBoot = true; tmp.cleanOnBoot = true;
# Encrypted drives # Encrypted drives

View file

@ -87,8 +87,6 @@
})) }))
]; ];
hardware.opengl.extraPackages = with pkgs; [ vulkan-validation-layers ];
# Home # Home
home-manager.users.artemis = { home-manager.users.artemis = {
programs.git.signing.key = programs.git.signing.key =