python312Packages.publicsuffixlist: 1.0.2.20250124 -> 1.0.2.20250127 (#378379)
[NixPkgs.git] / pkgs / os-specific / linux / kernel / zen-kernels.nix
blobde14f7f5d31fc41b3f1dfbe10d46011c14db08a2
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   buildLinux,
6   variant,
7   ...
8 }@args:
10 let
11   # comments with variant added for update script
12   variants = {
13     # ./update-zen.py zen
14     zen = {
15       version = "6.12.10"; # zen
16       suffix = "zen1"; # zen
17       sha256 = "1kd3bcnhlarnrpl87mrdb5r9k2jdq7m8607ai847dkmncw7q2d1q"; # zen
18       isLqx = false;
19     };
20     # ./update-zen.py lqx
21     lqx = {
22       version = "6.12.10"; # lqx
23       suffix = "lqx1"; # lqx
24       sha256 = "0sg905xdyy9wmjqv6d8p5jr307j767wgk27gzxhq8dnb2dz2yg5v"; # lqx
25       isLqx = true;
26     };
27   };
28   zenKernelsFor =
29     {
30       version,
31       suffix,
32       sha256,
33       isLqx,
34     }:
35     buildLinux (
36       args
37       // {
38         inherit version;
39         pname = "linux-${if isLqx then "lqx" else "zen"}";
40         modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
41         isZen = true;
43         src = fetchFromGitHub {
44           owner = "zen-kernel";
45           repo = "zen-kernel";
46           rev = "v${version}-${suffix}";
47           inherit sha256;
48         };
50         # This is based on the following sources:
51         # - zen: https://gitlab.archlinux.org/archlinux/packaging/packages/linux-zen/-/blob/main/config
52         # - lqx: https://github.com/damentz/liquorix-package/blob/6.8/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64
53         # - Liquorix features: https://liquorix.net/
54         # The list below is not exhaustive, so the kernels probably doesn't match
55         # the upstream, but should bring most of the improvements that will be
56         # expected by users
57         structuredExtraConfig =
58           with lib.kernel;
59           {
60             # Zen Interactive tuning
61             ZEN_INTERACTIVE = yes;
63             # FQ-Codel Packet Scheduling
64             NET_SCH_DEFAULT = yes;
65             DEFAULT_FQ_CODEL = yes;
67             # Preempt (low-latency)
68             PREEMPT = lib.mkOverride 60 yes;
69             PREEMPT_VOLUNTARY = lib.mkOverride 60 no;
71             # Preemptible tree-based hierarchical RCU
72             TREE_RCU = yes;
73             PREEMPT_RCU = yes;
74             RCU_EXPERT = yes;
75             TREE_SRCU = yes;
76             TASKS_RCU_GENERIC = yes;
77             TASKS_RCU = yes;
78             TASKS_RUDE_RCU = yes;
79             TASKS_TRACE_RCU = yes;
80             RCU_STALL_COMMON = yes;
81             RCU_NEED_SEGCBLIST = yes;
82             RCU_FANOUT = freeform "64";
83             RCU_FANOUT_LEAF = freeform "16";
84             RCU_BOOST = yes;
85             RCU_BOOST_DELAY = option (freeform "500");
86             RCU_NOCB_CPU = yes;
87             RCU_LAZY = yes;
88             RCU_DOUBLE_CHECK_CB_TIME = yes;
90             # BFQ I/O scheduler
91             IOSCHED_BFQ = lib.mkOverride 60 yes;
93             # Futex WAIT_MULTIPLE implementation for Wine / Proton Fsync.
94             FUTEX = yes;
95             FUTEX_PI = yes;
97             # NT synchronization primitive emulation
98             NTSYNC = yes;
100             # Preemptive Full Tickless Kernel at 1000Hz
101             HZ = freeform "1000";
102             HZ_1000 = yes;
104           }
105           // lib.optionalAttrs (isLqx) {
106             # Google's BBRv3 TCP congestion Control
107             TCP_CONG_BBR = yes;
108             DEFAULT_BBR = yes;
110             # PDS Process Scheduler
111             SCHED_ALT = yes;
112             SCHED_PDS = yes;
114             # https://github.com/damentz/liquorix-package/commit/a7055b936c0f4edb8f6afd5263fe1d2f8a5cd877
115             RCU_BOOST = no;
116             RCU_LAZY = lib.mkOverride 60 no;
118             # Swap storage is compressed with LZ4 using zswap
119             ZSWAP_COMPRESSOR_DEFAULT_LZ4 = lib.mkOptionDefault yes;
120             ZSWAP_COMPRESSOR_DEFAULT_ZSTD = lib.mkDefault no;
122             # Fix error: unused option: XXX.
123             CFS_BANDWIDTH = lib.mkForce (option no);
124             PSI = lib.mkForce (option no);
125             RT_GROUP_SCHED = lib.mkForce (option no);
126             SCHED_AUTOGROUP = lib.mkForce (option no);
127             SCHED_CLASS_EXT = lib.mkForce (option no);
128             SCHED_CORE = lib.mkForce (option no);
129             UCLAMP_TASK = lib.mkForce (option no);
130             UCLAMP_TASK_GROUP = lib.mkForce (option no);
131           };
133         passthru.updateScript = [
134           ./update-zen.py
135           (if isLqx then "lqx" else "zen")
136         ];
138         extraMeta = {
139           branch = lib.versions.majorMinor version + "/master";
140           maintainers = with lib.maintainers; [
141             thiagokokada
142             jerrysm64
143           ];
144           description =
145             "Built using the best configuration and kernel sources for desktop, multimedia, and gaming workloads."
146             + lib.optionalString isLqx " (Same as linux_zen, but less aggressive release schedule and additional extra config)";
147           broken = stdenv.hostPlatform.isAarch64;
148         };
150       }
151       // (args.argsOverride or { })
152     );
154 zenKernelsFor variants.${variant}