From 1bc6e50b18e8c563821a9202df15c8aa2223ef3b Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Thu, 19 Dec 2024 11:19:46 -0500 Subject: [PATCH] hw/gaming: default to zen kernel --- hwModules/common/gaming/default.nix | 68 ++++++++++++++++------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/hwModules/common/gaming/default.nix b/hwModules/common/gaming/default.nix index 2630e9ea..3ac60ab3 100644 --- a/hwModules/common/gaming/default.nix +++ b/hwModules/common/gaming/default.nix @@ -1,37 +1,45 @@ -{lib, ...}: { - boot.kernel.sysctl = { - # Improved file monitoring - "fs.inotify.max_user_instances" = lib.mkOverride 100 8192; # Re-use the default from Bazzite even though the default NixOS value is higher. - # "fs.inotify.max_user_watches" = lib.mkOverride 100 524288; +{ + lib, + pkgs, + ... +}: { + boot = { + kernel.sysctl = { + # Improved file monitoring + "fs.inotify.max_user_instances" = lib.mkOverride 100 8192; # Re-use the default from Bazzite even though the default NixOS value is higher. + # "fs.inotify.max_user_watches" = lib.mkOverride 100 524288; - # Disable watchdogs for maximum performance at the cost of resiliency - "kernel.nmi_watchdog" = lib.mkOverride 100 0; - "kernel.soft_watchdog" = lib.mkDefault 0; - # "kernel.split_lock_mitigate" = lib.mkOverride 100 0; - "kernel.watchdog" = lib.mkDefault 0; + # Disable watchdogs for maximum performance at the cost of resiliency + "kernel.nmi_watchdog" = lib.mkOverride 100 0; + "kernel.soft_watchdog" = lib.mkDefault 0; + # "kernel.split_lock_mitigate" = lib.mkOverride 100 0; + "kernel.watchdog" = lib.mkDefault 0; - "kernel.sched_cfs_bandwidth_slice_u" = lib.mkDefault 3000; - "kernel.sched_latency_ns" = lib.mkDefault 3000000; - "kernel.sched_min_granularity_ns" = lib.mkDefault 300000; - "kernel.sched_wakeup_granularity_ns" = lib.mkDefault 500000; - "kernel.sched_migration_cost_ns" = lib.mkDefault 50000; - "kernel.sched_nr_migrate" = lib.mkDefault 128; - "kernel.split_lock_mitigate" = lib.mkDefault 0; + "kernel.sched_cfs_bandwidth_slice_u" = lib.mkDefault 3000; + "kernel.sched_latency_ns" = lib.mkDefault 3000000; + "kernel.sched_min_granularity_ns" = lib.mkDefault 300000; + "kernel.sched_wakeup_granularity_ns" = lib.mkDefault 500000; + "kernel.sched_migration_cost_ns" = lib.mkDefault 50000; + "kernel.sched_nr_migrate" = lib.mkDefault 128; + "kernel.split_lock_mitigate" = lib.mkDefault 0; - # Network optimizations - "net.core.default_qdisc" = lib.mkDefault "fq"; - "net.ipv4.tcp_congestion_control" = lib.mkDefault "bbr"; - "net.ipv4.tcp_fin_timeout" = lib.mkDefault 5; - "net.ipv4.tcp_mtu_probing" = lib.mkForce 1; + # Network optimizations + "net.core.default_qdisc" = lib.mkDefault "fq"; + "net.ipv4.tcp_congestion_control" = lib.mkDefault "bbr"; + "net.ipv4.tcp_fin_timeout" = lib.mkDefault 5; + "net.ipv4.tcp_mtu_probing" = lib.mkForce 1; - # Memory management - "vm.dirty_background_bytes" = lib.mkDefault 134217728; - "vm.dirty_bytes" = lib.mkDefault 268435456; - # "vm.max_map_count" = lib.mkOverride 100 2147483642; - "vm.page-cluster" = lib.mkDefault 0; - "vm.swappiness" = lib.mkDefault 180; - "vm.watermark_boost_factor" = lib.mkDefault 0; - "vm.watermark_scale_factor" = lib.mkDefault 125; + # Memory management + "vm.dirty_background_bytes" = lib.mkDefault 134217728; + "vm.dirty_bytes" = lib.mkDefault 268435456; + # "vm.max_map_count" = lib.mkOverride 100 2147483642; + "vm.page-cluster" = lib.mkDefault 0; + "vm.swappiness" = lib.mkDefault 180; + "vm.watermark_boost_factor" = lib.mkDefault 0; + "vm.watermark_scale_factor" = lib.mkDefault 125; + }; + + kernelPackages = pkgs.linuxPackages_zen; }; services = {