kernel changes and ram compression

This commit is contained in:
death916 2026-02-11 04:42:09 -08:00
parent 0fe14c2cb3
commit 9808bc6f7a
5 changed files with 74 additions and 21 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
*.md
# *.md
*.jpg

View file

@ -21,6 +21,8 @@
url = "github:nix-community/stylix/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release";
};
outputs =
@ -54,12 +56,14 @@
"https://hyprland.cachix.org"
"https://cache.flox.dev"
"https://nix-community.cachix.org"
"https://attic.xuyh0120.win/lantian"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc="
];
};

View file

@ -27,12 +27,14 @@
"https://hyprland.cachix.org"
"https://cache.flox.dev"
"https://nix-community.cachix.org"
"https://attic.xuyh0120.win/lantian"
];
nix.settings.trusted-public-keys = lib.mkForce [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"lantian:EeAUQ+W+6r7EtwnmYjeVwx5kOGEBpjlBfPlzGlTNvHc="
];

View file

@ -3,6 +3,8 @@
config,
pkgs,
overlays,
inputs,
lib,
...
}:
@ -11,6 +13,7 @@
nixpkgs.overlays = [
# overlays.rust
# overlays.halloy
inputs.nix-cachyos-kernel.overlays.pinned
];
imports = [
@ -23,6 +26,28 @@
../modules/nixos/laptop/restic.nix
];
# Use CachyOS Kernel
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest;
# Network Optimizations (BBR + CAKE)
boot.kernel.sysctl = {
# Use CAKE traffic shaper to prevent lag (bufferbloat) on WiFi
"net.core.default_qdisc" = "cake";
# Use BBR for better throughput
"net.ipv4.tcp_congestion_control" = "bbr";
};
specialisation = {
stable-kernel.configuration = {
system.nixos.tags = [ "stable" ];
boot.kernelPackages = lib.mkForce pkgs.linuxPackages;
boot.kernel.sysctl = lib.mkForce {
"net.core.default_qdisc" = "fq_codel"; # Revert to default
"net.ipv4.tcp_congestion_control" = "cubic"; # Revert to default
};
};
};
# nix.settings.substituters = [
# "https://hyprland.cachix.org"
# "https://cache.flox.dev"
@ -50,4 +75,4 @@
system.stateVersion = "24.11";
stylix.image = "/home/death916/Documents/nix-config/home-manager/wallpaper.jpg";
}
}

View file

@ -1,8 +1,11 @@
# ~/nixconfig/nixos/homelab.nix.new
{ lib, ... }:
{
lib,
pkgs,
inputs,
...
}:
{
imports = [
# ../modules/nextcloud-setup.nix
../modules/media/arr-suite.nix
../modules/smb.nix
../modules/nixos/homelab/networking.nix
@ -13,28 +16,38 @@
];
config = {
zramSwap.enable = lib.mkForce false;
boot.kernel.sysctl = { "vm.swappiness" = 80; };
boot.kernelParams = [ "processor.max_cstate=1" ];
hardware.cpu.amd.updateMicrocode = true;
# Wait for network to be online
# systemd.services.NetworkManager-wait-online.enable = true;
nixpkgs.overlays = [
inputs.nix-cachyos-kernel.overlays.pinned
];
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest;
zramSwap.enable = lib.mkForce false;
boot.kernelParams = [
"zswap.enabled=1"
"zswap.compressor=zstd"
"zswap.max_pool_percent=20"
"processor.max_cstate=1"
];
boot.kernel.sysctl = {
"vm.swappiness" = 30;
"vm.vfs_cache_pressure" = 100;
# Use CAKE traffic shaper to prevent lag (bufferbloat) during heavy downloads
"net.core.default_qdisc" = "cake";
# Use BBR for better throughput and reduced buffering for media streaming
"net.ipv4.tcp_congestion_control" = "bbr";
};
hardware.cpu.amd.updateMicrocode = true;
# Service dependencies
systemd.services.sonarr.after = [ "network-online.target" ];
systemd.services.sonarr.requires = [ "network-online.target" ];
systemd.services.radarr.after = [ "network-online.target" ];
systemd.services.radarr.requires = [ "network-online.target" ];
systemd.services.prowlarr.after = [ "network-online.target" ];
systemd.services.prowlarr.requires = [ "network-online.target" ];
# systemd.services.nextcloud-setup.after = [
# "network-online.target"
# "postgresql.service"
# ];
# systemd.services.nextcloud-setup.requires = [
# "network-online.target"
# "postgresql.service"
# ];
arrSuite.unpackerr.enable = true;
system.stateVersion = "24.11";
@ -42,5 +55,14 @@
# Auto-reboot the system if it hangs (5 minute timeout)
boot.kernelModules = [ "sp5100_tco" ];
systemd.watchdog.rebootTime = "300s";
specialisation = {
stable-kernel.configuration = {
system.nixos.tags = [ "stable" ];
boot.kernelPackages = lib.mkForce pkgs.linuxPackages;
boot.kernelParams = lib.mkForce [ "processor.max_cstate=1" ]; # Keep existing fix, remove zswap
zramSwap.enable = lib.mkForce true; # Re-enable ZRAM for stable kernel if desired, or keep false
};
};
};
}
}