1{ lib, stdenv, fetchFromGitHub, buildLinux, ... } @ args:
2
3let
4 # These names are how they are designated in https://xanmod.org.
5
6 # NOTE: When updating these, please also take a look at the changes done to
7 # kernel config in the xanmod version commit
8 ltsVariant = {
9 version = "6.6.42";
10 hash = "sha256-0YqvOObUHP2S8Jf1H+fzAZ+wOMoFt1BLxWilqt6ohVg=";
11 variant = "lts";
12 };
13
14 mainVariant = {
15 version = "6.9.11";
16 hash = "sha256-c6Mkk37SFoC9hJfh/iQqyNzGJJjN0W28VLta/nayCgc=";
17 variant = "main";
18 };
19
20 xanmodKernelFor = { version, suffix ? "xanmod1", hash, variant }: buildLinux (args // rec {
21 inherit version;
22 pname = "linux-xanmod";
23 modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
24
25 src = fetchFromGitHub {
26 owner = "xanmod";
27 repo = "linux";
28 rev = modDirVersion;
29 inherit hash;
30 };
31
32 structuredExtraConfig = with lib.kernel; {
33 # CPUFreq governor Performance
34 CPU_FREQ_DEFAULT_GOV_PERFORMANCE = lib.mkOverride 60 yes;
35 CPU_FREQ_DEFAULT_GOV_SCHEDUTIL = lib.mkOverride 60 no;
36
37 # Full preemption
38 PREEMPT = lib.mkOverride 60 yes;
39 PREEMPT_VOLUNTARY = lib.mkOverride 60 no;
40
41 # Google's BBRv3 TCP congestion Control
42 TCP_CONG_BBR = yes;
43 DEFAULT_BBR = yes;
44
45 # Preemptive Full Tickless Kernel at 250Hz
46 HZ = freeform "250";
47 HZ_250 = yes;
48 HZ_1000 = no;
49
50 # RCU_BOOST and RCU_EXP_KTHREAD
51 RCU_EXPERT = yes;
52 RCU_FANOUT = freeform "64";
53 RCU_FANOUT_LEAF = freeform "16";
54 RCU_BOOST = yes;
55 RCU_BOOST_DELAY = freeform "0";
56 RCU_EXP_KTHREAD = yes;
57 };
58
59 extraMeta = {
60 branch = lib.versions.majorMinor version;
61 maintainers = with lib.maintainers; [ moni lovesegfault atemu shawn8901 zzzsy ];
62 description = "Built with custom settings and new features built to provide a stable, responsive and smooth desktop experience";
63 broken = stdenv.isAarch64;
64 };
65 } // (args.argsOverride or { }));
66in
67{
68 lts = xanmodKernelFor ltsVariant;
69 main = xanmodKernelFor mainVariant;
70}