1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 buildLinux,
6 variant,
7 ...
8}@args:
9
10let
11 # These names are how they are designated in https://xanmod.org.
12
13 # NOTE: When updating these, please also take a look at the changes done to
14 # kernel config in the xanmod version commit
15 variants = {
16 # ./update-xanmod.sh lts
17 lts = {
18 version = "6.12.41";
19 hash = "sha256-REi1cQBAYsfBLCkyhLQfbsREPMzvJHFbCUg1p8oNamA=";
20 };
21 # ./update-xanmod.sh main
22 main = {
23 version = "6.15.9";
24 hash = "sha256-43SaSDdOfz+aG2T2C9UFbbXYi/7YxbQfTYrKjeEMP+E=";
25 };
26 };
27
28 xanmodKernelFor =
29 {
30 version,
31 suffix ? "xanmod1",
32 hash,
33 }:
34 buildLinux (
35 args
36 // rec {
37 inherit version;
38 pname = "linux-xanmod";
39 modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
40
41 src = fetchFromGitLab {
42 owner = "xanmod";
43 repo = "linux";
44 rev = modDirVersion;
45 inherit hash;
46 };
47
48 structuredExtraConfig = with lib.kernel; {
49 # CPUFreq governor Performance
50 CPU_FREQ_DEFAULT_GOV_PERFORMANCE = lib.mkOverride 60 yes;
51 CPU_FREQ_DEFAULT_GOV_SCHEDUTIL = lib.mkOverride 60 no;
52
53 # Full preemption
54 PREEMPT = lib.mkOverride 60 yes;
55 PREEMPT_VOLUNTARY = lib.mkOverride 60 no;
56
57 # Google's BBRv3 TCP congestion Control
58 TCP_CONG_BBR = yes;
59 DEFAULT_BBR = yes;
60
61 # Preemptive Full Tickless Kernel at 250Hz
62 HZ = freeform "250";
63 HZ_250 = yes;
64 HZ_1000 = no;
65
66 # RCU_BOOST and RCU_EXP_KTHREAD
67 RCU_EXPERT = yes;
68 RCU_FANOUT = freeform "64";
69 RCU_FANOUT_LEAF = freeform "16";
70 RCU_BOOST = yes;
71 RCU_BOOST_DELAY = freeform "0";
72 RCU_EXP_KTHREAD = yes;
73 };
74
75 extraPassthru.updateScript = [
76 ./update-xanmod.sh
77 variant
78 ];
79
80 extraMeta = {
81 branch = lib.versions.majorMinor version;
82 maintainers = with lib.maintainers; [
83 moni
84 lovesegfault
85 atemu
86 zzzsy
87 eljamm
88 ];
89 teams = [ ];
90 description = "Built with custom settings and new features built to provide a stable, responsive and smooth desktop experience";
91 broken = stdenv.hostPlatform.isAarch64;
92 };
93 }
94 // (args.argsOverride or { })
95 );
96in
97xanmodKernelFor variants.${variant}