lol
1{ pkgs
2, linuxKernel
3, config
4, buildPackages
5, callPackage
6, makeOverridable
7, recurseIntoAttrs
8, dontRecurseIntoAttrs
9, stdenv
10, stdenvNoCC
11, newScope
12, lib
13, fetchurl
14, gcc10Stdenv
15}:
16
17# When adding a kernel:
18 # - Update packageAliases.linux_latest to the latest version
19 # - Update the rev in ../os-specific/linux/kernel/linux-libre.nix to the latest one.
20 # - Update linux_latest_hardened when the patches become available
21
22with linuxKernel;
23
24let
25 deblobKernel = kernel: callPackage ../os-specific/linux/kernel/linux-libre.nix {
26 linux = kernel;
27 };
28
29 # Hardened Linux
30 hardenedKernelFor = kernel': overrides:
31 let
32 kernel = kernel'.override overrides;
33 version = kernelPatches.hardened.${kernel.meta.branch}.version;
34 major = lib.versions.major version;
35 sha256 = kernelPatches.hardened.${kernel.meta.branch}.sha256;
36 modDirVersion' = builtins.replaceStrings [ kernel.version ] [ version ] kernel.modDirVersion;
37 in kernel.override {
38 structuredExtraConfig = import ../os-specific/linux/kernel/hardened/config.nix {
39 inherit stdenv lib version;
40 };
41 argsOverride = {
42 inherit version;
43 modDirVersion = modDirVersion' + kernelPatches.hardened.${kernel.meta.branch}.extra;
44 src = fetchurl {
45 url = "mirror://kernel/linux/kernel/v${major}.x/linux-${version}.tar.xz";
46 inherit sha256;
47 };
48 extraMeta = {
49 broken = kernel.meta.broken;
50 };
51 };
52 kernelPatches = kernel.kernelPatches ++ [
53 kernelPatches.hardened.${kernel.meta.branch}
54 ];
55 isHardened = true;
56 };
57in {
58 kernelPatches = callPackage ../os-specific/linux/kernel/patches.nix { };
59
60 kernels = recurseIntoAttrs (lib.makeExtensible (self: with self;
61 let callPackage = newScope self; in {
62
63 # NOTE: PLEASE DO NOT ADD NEW VENDOR KERNELS TO NIXPKGS.
64 # New vendor kernels should go to nixos-hardware instead.
65 # e.g. https://github.com/NixOS/nixos-hardware/tree/master/microsoft/surface/kernel
66
67 linux_rpi1 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
68 kernelPatches = with kernelPatches; [
69 bridge_stp_helper
70 request_key_helper
71 ];
72 rpiVersion = 1;
73 };
74
75 linux_rpi2 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
76 kernelPatches = with kernelPatches; [
77 bridge_stp_helper
78 request_key_helper
79 ];
80 rpiVersion = 2;
81 };
82
83 linux_rpi3 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
84 kernelPatches = with kernelPatches; [
85 bridge_stp_helper
86 request_key_helper
87 ];
88 rpiVersion = 3;
89 };
90
91 linux_rpi4 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
92 kernelPatches = with kernelPatches; [
93 bridge_stp_helper
94 request_key_helper
95 ];
96 rpiVersion = 4;
97 };
98
99 linux_4_19 = callPackage ../os-specific/linux/kernel/mainline.nix {
100 branch = "4.19";
101 kernelPatches =
102 [ kernelPatches.bridge_stp_helper
103 kernelPatches.request_key_helper
104 kernelPatches.modinst_arg_list_too_long
105 ];
106 };
107
108 linux_5_4 = callPackage ../os-specific/linux/kernel/mainline.nix {
109 branch = "5.4";
110 kernelPatches = [
111 kernelPatches.bridge_stp_helper
112 kernelPatches.request_key_helper
113 kernelPatches.rtl8761b_support
114 ];
115 };
116
117 linux_rt_5_4 = callPackage ../os-specific/linux/kernel/linux-rt-5.4.nix {
118 kernelPatches = [
119 kernelPatches.bridge_stp_helper
120 kernelPatches.request_key_helper
121 ];
122 };
123
124 linux_5_10 = callPackage ../os-specific/linux/kernel/mainline.nix {
125 branch = "5.10";
126 kernelPatches = [
127 kernelPatches.bridge_stp_helper
128 kernelPatches.request_key_helper
129 ];
130 };
131
132 linux_rt_5_10 = callPackage ../os-specific/linux/kernel/linux-rt-5.10.nix {
133 kernelPatches = [
134 kernelPatches.bridge_stp_helper
135 kernelPatches.request_key_helper
136 kernelPatches.export-rt-sched-migrate
137 ];
138 };
139
140 linux_5_15 = callPackage ../os-specific/linux/kernel/mainline.nix {
141 branch = "5.15";
142 kernelPatches = [
143 kernelPatches.bridge_stp_helper
144 kernelPatches.request_key_helper
145 ];
146 };
147
148 linux_rt_5_15 = callPackage ../os-specific/linux/kernel/linux-rt-5.15.nix {
149 kernelPatches = [
150 kernelPatches.bridge_stp_helper
151 kernelPatches.request_key_helper
152 kernelPatches.export-rt-sched-migrate
153 ];
154 };
155
156 linux_6_1 = callPackage ../os-specific/linux/kernel/mainline.nix {
157 branch = "6.1";
158 kernelPatches = [
159 kernelPatches.bridge_stp_helper
160 kernelPatches.request_key_helper
161 ];
162 };
163
164 linux_rt_6_1 = callPackage ../os-specific/linux/kernel/linux-rt-6.1.nix {
165 kernelPatches = [
166 kernelPatches.bridge_stp_helper
167 kernelPatches.request_key_helper
168 kernelPatches.export-rt-sched-migrate
169 ];
170 };
171
172 linux_6_6 = callPackage ../os-specific/linux/kernel/mainline.nix {
173 branch = "6.6";
174 kernelPatches = [
175 kernelPatches.bridge_stp_helper
176 kernelPatches.request_key_helper
177 ];
178 };
179
180 linux_rt_6_6 = callPackage ../os-specific/linux/kernel/linux-rt-6.6.nix {
181 kernelPatches = [
182 kernelPatches.bridge_stp_helper
183 kernelPatches.request_key_helper
184 kernelPatches.export-rt-sched-migrate
185 ];
186 };
187
188 linux_6_8 = callPackage ../os-specific/linux/kernel/mainline.nix {
189 branch = "6.8";
190 kernelPatches = [
191 kernelPatches.bridge_stp_helper
192 kernelPatches.request_key_helper
193 kernelPatches.rust_1_75
194 kernelPatches.rust_1_76
195 kernelPatches.rust_1_77-6_8
196 ];
197 };
198
199 linux_6_9 = callPackage ../os-specific/linux/kernel/mainline.nix {
200 branch = "6.9";
201 kernelPatches = [
202 kernelPatches.bridge_stp_helper
203 kernelPatches.request_key_helper
204 kernelPatches.rust_1_77-6_9
205 ];
206 };
207
208 linux_testing = let
209 testing = callPackage ../os-specific/linux/kernel/mainline.nix {
210 # A special branch that tracks the kernel under the release process
211 # i.e. which has at least a public rc1 and is not released yet.
212 branch = "testing";
213 kernelPatches = [
214 kernelPatches.bridge_stp_helper
215 kernelPatches.request_key_helper
216 kernelPatches.rust_1_77-6_9
217 ];
218 };
219 latest = packageAliases.linux_latest.kernel;
220 in if latest.kernelAtLeast testing.baseVersion
221 then latest
222 else testing;
223
224 # Using zenKernels like this due lqx&zen came from one source, but may have different base kernel version
225 # https://github.com/NixOS/nixpkgs/pull/161773#discussion_r820134708
226 zenKernels = callPackage ../os-specific/linux/kernel/zen-kernels.nix;
227
228 linux_zen = (zenKernels {
229 kernelPatches = [
230 kernelPatches.bridge_stp_helper
231 kernelPatches.request_key_helper
232 ];
233 }).zen;
234
235 linux_lqx = (zenKernels {
236 kernelPatches = [
237 kernelPatches.bridge_stp_helper
238 kernelPatches.request_key_helper
239 ];
240 }).lqx;
241
242 # This contains the variants of the XanMod kernel
243 xanmodKernels = callPackage ../os-specific/linux/kernel/xanmod-kernels.nix {
244 kernelPatches = [
245 kernelPatches.bridge_stp_helper
246 kernelPatches.request_key_helper
247 ];
248 };
249
250 linux_xanmod = xanmodKernels.lts;
251 linux_xanmod_stable = xanmodKernels.main;
252 linux_xanmod_latest = xanmodKernels.main;
253
254 linux_libre = deblobKernel packageAliases.linux_default.kernel;
255
256 linux_latest_libre = deblobKernel packageAliases.linux_latest.kernel;
257
258 linux_hardened = hardenedKernelFor packageAliases.linux_default.kernel { };
259
260 linux_4_19_hardened = hardenedKernelFor kernels.linux_4_19 {
261 stdenv = gcc10Stdenv;
262 buildPackages = buildPackages // { stdenv = buildPackages.gcc10Stdenv; };
263 };
264 linux_5_4_hardened = hardenedKernelFor kernels.linux_5_4 {
265 stdenv = gcc10Stdenv;
266 buildPackages = buildPackages // { stdenv = buildPackages.gcc10Stdenv; };
267 };
268 linux_5_10_hardened = hardenedKernelFor kernels.linux_5_10 { };
269 linux_5_15_hardened = hardenedKernelFor kernels.linux_5_15 { };
270 linux_6_1_hardened = hardenedKernelFor kernels.linux_6_1 { };
271 linux_6_6_hardened = hardenedKernelFor kernels.linux_6_6 { };
272 linux_6_8_hardened = hardenedKernelFor kernels.linux_6_8 { };
273 linux_6_9_hardened = hardenedKernelFor kernels.linux_6_9 { };
274
275 } // lib.optionalAttrs config.allowAliases {
276 linux_4_9 = throw "linux 4.9 was removed because it will reach its end of life within 22.11";
277 linux_4_14 = throw "linux 4.14 was removed because it will reach its end of life within 23.11";
278 linux_5_18 = throw "linux 5.18 was removed because it has reached its end of life upstream";
279 linux_5_19 = throw "linux 5.19 was removed because it has reached its end of life upstream";
280 linux_6_0 = throw "linux 6.0 was removed because it has reached its end of life upstream";
281 linux_6_2 = throw "linux 6.2 was removed because it has reached its end of life upstream";
282 linux_6_3 = throw "linux 6.3 was removed because it has reached its end of life upstream";
283 linux_6_4 = throw "linux 6.4 was removed because it has reached its end of life upstream";
284 linux_6_5 = throw "linux 6.5 was removed because it has reached its end of life upstream";
285 linux_6_7 = throw "linux 6.7 was removed because it has reached its end of life upstream";
286
287 linux_xanmod_tt = throw "linux_xanmod_tt was removed because upstream no longer offers this option";
288
289 linux_5_18_hardened = throw "linux 5.18 was removed because it has reached its end of life upstream";
290 linux_5_19_hardened = throw "linux 5.19 was removed because it has reached its end of life upstream";
291 linux_6_0_hardened = throw "linux 6.0 was removed because it has reached its end of life upstream";
292 linux_6_7_hardened = throw "linux 6.7 was removed because it has reached its end of life upstream";
293 }));
294 /* Linux kernel modules are inherently tied to a specific kernel. So
295 rather than provide specific instances of those packages for a
296 specific kernel, we have a function that builds those packages
297 for a specific kernel. This function can then be called for
298 whatever kernel you're using. */
299
300 packagesFor = kernel_: lib.makeExtensible (self: with self;
301 let callPackage = newScope self; in {
302 inherit callPackage;
303 kernel = kernel_;
304 inherit (kernel) stdenv; # in particular, use the same compiler by default
305
306 # to help determine module compatibility
307 inherit (kernel) isZen isHardened isLibre;
308 inherit (kernel) kernelOlder kernelAtLeast;
309 # Obsolete aliases (these packages do not depend on the kernel).
310 inherit (pkgs) odp-dpdk pktgen; # added 2018-05
311 inherit (pkgs) bcc bpftrace; # added 2021-12
312 inherit (pkgs) oci-seccomp-bpf-hook; # added 2022-11
313 inherit (pkgs) dpdk; # added 2024-03
314
315 acpi_call = callPackage ../os-specific/linux/acpi-call {};
316
317 akvcam = callPackage ../os-specific/linux/akvcam { };
318
319 amdgpu-pro = callPackage ../os-specific/linux/amdgpu-pro { };
320
321 apfs = callPackage ../os-specific/linux/apfs { };
322
323 ax99100 = callPackage ../os-specific/linux/ax99100 {};
324
325 batman_adv = callPackage ../os-specific/linux/batman-adv {};
326
327 bbswitch = callPackage ../os-specific/linux/bbswitch {};
328
329 ch9344 = callPackage ../os-specific/linux/ch9344 { };
330
331 chipsec = callPackage ../tools/security/chipsec {
332 inherit kernel;
333 withDriver = true;
334 };
335
336 cryptodev = callPackage ../os-specific/linux/cryptodev { };
337
338 cpupower = callPackage ../os-specific/linux/cpupower { };
339
340 ddcci-driver = callPackage ../os-specific/linux/ddcci { };
341
342 dddvb = callPackage ../os-specific/linux/dddvb { };
343
344 decklink = callPackage ../os-specific/linux/decklink { };
345
346 digimend = callPackage ../os-specific/linux/digimend { };
347
348 dpdk-kmods = callPackage ../os-specific/linux/dpdk-kmods { };
349
350 exfat-nofuse = if lib.versionOlder kernel.version "5.8" then callPackage ../os-specific/linux/exfat { } else null;
351
352 evdi = callPackage ../os-specific/linux/evdi { };
353
354 fanout = callPackage ../os-specific/linux/fanout { };
355
356 framework-laptop-kmod = callPackage ../os-specific/linux/framework-laptop-kmod { };
357
358 fwts-efi-runtime = callPackage ../os-specific/linux/fwts/module.nix { };
359
360 gasket = callPackage ../os-specific/linux/gasket { };
361
362 gcadapter-oc-kmod = callPackage ../os-specific/linux/gcadapter-oc-kmod { };
363
364 hyperv-daemons = callPackage ../os-specific/linux/hyperv-daemons { };
365
366 e1000e = if lib.versionOlder kernel.version "4.10" then callPackage ../os-specific/linux/e1000e {} else null;
367
368 intel-speed-select = if lib.versionAtLeast kernel.version "5.3" then callPackage ../os-specific/linux/intel-speed-select { } else null;
369
370 ipu6-drivers = callPackage ../os-specific/linux/ipu6-drivers {};
371
372 ivsc-driver = callPackage ../os-specific/linux/ivsc-driver {};
373
374 ixgbevf = callPackage ../os-specific/linux/ixgbevf {};
375
376 it87 = callPackage ../os-specific/linux/it87 {};
377
378 asus-ec-sensors = callPackage ../os-specific/linux/asus-ec-sensors {};
379
380 asus-wmi-sensors = callPackage ../os-specific/linux/asus-wmi-sensors {};
381
382 ena = callPackage ../os-specific/linux/ena {};
383
384 kvdo = callPackage ../os-specific/linux/kvdo {};
385
386 lenovo-legion-module = callPackage ../os-specific/linux/lenovo-legion { };
387
388 linux-gpib = callPackage ../applications/science/electronics/linux-gpib/kernel.nix { };
389
390 liquidtux = callPackage ../os-specific/linux/liquidtux {};
391
392 lkrg = callPackage ../os-specific/linux/lkrg {};
393
394 v4l2loopback = callPackage ../os-specific/linux/v4l2loopback { };
395
396 lttng-modules = callPackage ../os-specific/linux/lttng-modules { };
397
398 mstflint_access = callPackage ../os-specific/linux/mstflint_access { };
399
400 broadcom_sta = callPackage ../os-specific/linux/broadcom-sta { };
401
402 tbs = callPackage ../os-specific/linux/tbs { };
403
404 mbp2018-bridge-drv = callPackage ../os-specific/linux/mbp-modules/mbp2018-bridge-drv { };
405
406 nct6687d = callPackage ../os-specific/linux/nct6687d { };
407
408 new-lg4ff = callPackage ../os-specific/linux/new-lg4ff { };
409
410 nvidiabl = callPackage ../os-specific/linux/nvidiabl { };
411
412 nvidiaPackages = dontRecurseIntoAttrs (lib.makeExtensible (_: callPackage ../os-specific/linux/nvidia-x11 { }))
413 // { __attrsFailEvaluation = true; };
414
415 nvidia_x11 = nvidiaPackages.stable;
416 nvidia_x11_beta = nvidiaPackages.beta;
417 nvidia_x11_legacy340 = nvidiaPackages.legacy_340;
418 nvidia_x11_legacy390 = nvidiaPackages.legacy_390;
419 nvidia_x11_legacy470 = nvidiaPackages.legacy_470;
420 nvidia_x11_production = nvidiaPackages.production;
421 nvidia_x11_vulkan_beta = nvidiaPackages.vulkan_beta;
422 nvidia_dc = nvidiaPackages.dc;
423 nvidia_dc_520 = nvidiaPackages.dc_520;
424 nvidia_dc_535 = nvidiaPackages.dc_535;
425
426 # this is not a replacement for nvidia_x11*
427 # only the opensource kernel driver exposed for hydra to build
428 nvidia_x11_beta_open = nvidiaPackages.beta.open;
429 nvidia_x11_production_open = nvidiaPackages.production.open;
430 nvidia_x11_stable_open = nvidiaPackages.stable.open;
431 nvidia_x11_vulkan_beta_open = nvidiaPackages.vulkan_beta.open;
432
433 openrazer = callPackage ../os-specific/linux/openrazer/driver.nix { };
434
435 ply = callPackage ../os-specific/linux/ply { };
436
437 r8125 = callPackage ../os-specific/linux/r8125 { };
438
439 r8168 = callPackage ../os-specific/linux/r8168 { };
440
441 rtl8188eus-aircrack = callPackage ../os-specific/linux/rtl8188eus-aircrack { };
442
443 rtl8192eu = callPackage ../os-specific/linux/rtl8192eu { };
444
445 rtl8189es = callPackage ../os-specific/linux/rtl8189es { };
446
447 rtl8189fs = callPackage ../os-specific/linux/rtl8189fs { };
448
449 rtl8723ds = callPackage ../os-specific/linux/rtl8723ds { };
450
451 rtl8812au = callPackage ../os-specific/linux/rtl8812au { };
452
453 rtl8814au = callPackage ../os-specific/linux/rtl8814au { };
454
455 rtl8852au = callPackage ../os-specific/linux/rtl8852au { };
456
457 rtl8852bu = callPackage ../os-specific/linux/rtl8852bu { };
458
459 rtl88xxau-aircrack = callPackage ../os-specific/linux/rtl88xxau-aircrack {};
460
461 rtl8821au = callPackage ../os-specific/linux/rtl8821au { };
462
463 rtl8821ce = callPackage ../os-specific/linux/rtl8821ce { };
464
465 rtl88x2bu = callPackage ../os-specific/linux/rtl88x2bu { };
466
467 rtl8821cu = callPackage ../os-specific/linux/rtl8821cu { };
468
469 rtw88 = callPackage ../os-specific/linux/rtw88 { };
470
471 rtw89 = if lib.versionOlder kernel.version "5.16" then callPackage ../os-specific/linux/rtw89 { } else null;
472
473 openafs_1_8 = callPackage ../servers/openafs/1.8/module.nix { };
474 # Current stable release; don't backport release updates!
475 openafs = openafs_1_8;
476
477 opensnitch-ebpf = if lib.versionAtLeast kernel.version "5.10" then callPackage ../os-specific/linux/opensnitch-ebpf { } else null;
478
479 facetimehd = callPackage ../os-specific/linux/facetimehd { };
480
481 rust-out-of-tree-module = if lib.versionAtLeast kernel.version "6.7" then callPackage ../os-specific/linux/rust-out-of-tree-module { } else null;
482
483 tuxedo-keyboard = if lib.versionAtLeast kernel.version "4.14" then callPackage ../os-specific/linux/tuxedo-keyboard { } else null;
484
485 jool = callPackage ../os-specific/linux/jool { };
486
487 kvmfr = callPackage ../os-specific/linux/kvmfr { };
488
489 mba6x_bl = callPackage ../os-specific/linux/mba6x_bl { };
490
491 mwprocapture = callPackage ../os-specific/linux/mwprocapture { };
492
493 mxu11x0 = callPackage ../os-specific/linux/mxu11x0 { };
494
495 # compiles but has to be integrated into the kernel somehow
496 # Let's have it uncommented and finish it..
497 ndiswrapper = callPackage ../os-specific/linux/ndiswrapper { };
498
499 netatop = callPackage ../os-specific/linux/netatop { };
500
501 perf = callPackage ../os-specific/linux/kernel/perf { };
502
503 phc-intel = if lib.versionAtLeast kernel.version "4.10" then callPackage ../os-specific/linux/phc-intel { } else null;
504
505 prl-tools = callPackage ../os-specific/linux/prl-tools { };
506
507 isgx = callPackage ../os-specific/linux/isgx { };
508
509 rr-zen_workaround = callPackage ../development/tools/analysis/rr/zen_workaround.nix { };
510
511 shufflecake = callPackage ../os-specific/linux/shufflecake {};
512
513 sysdig = callPackage ../os-specific/linux/sysdig {};
514
515 systemtap = callPackage ../development/tools/profiling/systemtap { };
516
517 system76 = callPackage ../os-specific/linux/system76 { };
518
519 system76-acpi = callPackage ../os-specific/linux/system76-acpi { };
520
521 system76-power = callPackage ../os-specific/linux/system76-power { };
522
523 system76-io = callPackage ../os-specific/linux/system76-io { };
524
525 system76-scheduler = callPackage ../os-specific/linux/system76-scheduler { };
526
527 tmon = callPackage ../os-specific/linux/tmon { };
528
529 tp_smapi = callPackage ../os-specific/linux/tp_smapi { };
530
531 turbostat = callPackage ../os-specific/linux/turbostat { };
532
533 trelay = callPackage ../os-specific/linux/trelay { };
534
535 usbip = callPackage ../os-specific/linux/usbip { };
536
537 v86d = callPackage ../os-specific/linux/v86d { };
538
539 veikk-linux-driver = callPackage ../os-specific/linux/veikk-linux-driver { };
540 vendor-reset = callPackage ../os-specific/linux/vendor-reset { };
541
542 vhba = callPackage ../applications/emulators/cdemu/vhba.nix { };
543
544 virtio_vmmci = callPackage ../os-specific/linux/virtio_vmmci { };
545
546 virtualbox = callPackage ../os-specific/linux/virtualbox {
547 virtualbox = pkgs.virtualboxHardened;
548 };
549
550 virtualboxGuestAdditions = callPackage ../applications/virtualization/virtualbox/guest-additions { };
551
552 mm-tools = callPackage ../os-specific/linux/mm-tools { };
553
554 vmm_clock = callPackage ../os-specific/linux/vmm_clock { };
555
556 vmware = callPackage ../os-specific/linux/vmware { };
557
558 wireguard = if lib.versionOlder kernel.version "5.6" then callPackage ../os-specific/linux/wireguard { } else null;
559
560 x86_energy_perf_policy = callPackage ../os-specific/linux/x86_energy_perf_policy { };
561
562 xone = if lib.versionAtLeast kernel.version "5.4" then callPackage ../os-specific/linux/xone { } else null;
563
564 xpadneo = callPackage ../os-specific/linux/xpadneo { };
565
566 ithc = callPackage ../os-specific/linux/ithc { };
567
568 ryzen-smu = callPackage ../os-specific/linux/ryzen-smu { };
569
570 zenpower = callPackage ../os-specific/linux/zenpower { };
571
572 zfs_2_1 = callPackage ../os-specific/linux/zfs/2_1.nix {
573 configFile = "kernel";
574 inherit pkgs kernel;
575 };
576 zfs_2_2 = callPackage ../os-specific/linux/zfs/2_2.nix {
577 configFile = "kernel";
578 inherit pkgs kernel;
579 };
580 zfs_unstable = callPackage ../os-specific/linux/zfs/unstable.nix {
581 configFile = "kernel";
582 inherit pkgs kernel;
583 };
584 zfs = zfs_2_2;
585
586 can-isotp = callPackage ../os-specific/linux/can-isotp { };
587
588 qc71_laptop = callPackage ../os-specific/linux/qc71_laptop { };
589
590 hid-ite8291r3 = callPackage ../os-specific/linux/hid-ite8291r3 { };
591
592 hid-tmff2 = callPackage ../os-specific/linux/hid-tmff2 { };
593
594 drbd = callPackage ../os-specific/linux/drbd/driver.nix { };
595
596 } // lib.optionalAttrs config.allowAliases {
597 ati_drivers_x11 = throw "ati drivers are no longer supported by any kernel >=4.1"; # added 2021-05-18;
598 hid-nintendo = throw "hid-nintendo was added in mainline kernel version 5.16"; # Added 2023-07-30
599 sch_cake = throw "sch_cake was added in mainline kernel version 4.19"; # Added 2023-06-14
600 rtl8723bs = throw "rtl8723bs was added in mainline kernel version 4.12"; # Added 2023-06-14
601 vm-tools = self.mm-tools;
602 xmm7360-pci = throw "Support for the XMM7360 WWAN card was added to the iosm kmod in mainline kernel version 5.18";
603 });
604
605 hardenedPackagesFor = kernel: overrides: packagesFor (hardenedKernelFor kernel overrides);
606
607 vanillaPackages = {
608 # recurse to build modules for the kernels
609 linux_4_19 = recurseIntoAttrs (packagesFor kernels.linux_4_19);
610 linux_5_4 = recurseIntoAttrs (packagesFor kernels.linux_5_4);
611 linux_5_10 = recurseIntoAttrs (packagesFor kernels.linux_5_10);
612 linux_5_15 = recurseIntoAttrs (packagesFor kernels.linux_5_15);
613 linux_6_1 = recurseIntoAttrs (packagesFor kernels.linux_6_1);
614 linux_6_6 = recurseIntoAttrs (packagesFor kernels.linux_6_6);
615 linux_6_8 = recurseIntoAttrs (packagesFor kernels.linux_6_8);
616 linux_6_9 = recurseIntoAttrs (packagesFor kernels.linux_6_9);
617 __attrsFailEvaluation = true;
618 } // lib.optionalAttrs config.allowAliases {
619 linux_4_9 = throw "linux 4.9 was removed because it will reach its end of life within 22.11"; # Added 2022-11-08
620 linux_4_14 = throw "linux 4.14 was removed because it will reach its end of life within 23.11"; # Added 2023-10-11
621 linux_5_18 = throw "linux 5.18 was removed because it reached its end of life upstream"; # Added 2022-09-17
622 linux_5_19 = throw "linux 5.19 was removed because it reached its end of life upstream"; # Added 2022-11-01
623 linux_6_0 = throw "linux 6.0 was removed because it reached its end of life upstream"; # Added 2023-01-20
624 linux_6_2 = throw "linux 6.2 was removed because it reached its end of life upstream"; # Added 2023-05-26
625 linux_6_3 = throw "linux 6.3 was removed because it reached its end of life upstream"; # Added 2023-07-22
626 linux_6_4 = throw "linux 6.4 was removed because it reached its end of life upstream"; # Added 2023-10-02
627 linux_6_5 = throw "linux 6.5 was removed because it reached its end of life upstream"; # Added 2024-02-28
628 linux_6_7 = throw "linux 6.7 was removed because it reached its end of life upstream"; # Added 2024-04-04
629 };
630
631 rtPackages = {
632 # realtime kernel packages
633 linux_rt_5_4 = packagesFor kernels.linux_rt_5_4;
634 linux_rt_5_10 = packagesFor kernels.linux_rt_5_10;
635 linux_rt_5_15 = packagesFor kernels.linux_rt_5_15;
636 linux_rt_6_1 = packagesFor kernels.linux_rt_6_1;
637 linux_rt_6_6 = packagesFor kernels.linux_rt_6_6;
638 __attrsFailEvaluation = true;
639 };
640
641 rpiPackages = {
642 linux_rpi1 = packagesFor kernels.linux_rpi1;
643 linux_rpi2 = packagesFor kernels.linux_rpi2;
644 linux_rpi3 = packagesFor kernels.linux_rpi3;
645 linux_rpi4 = packagesFor kernels.linux_rpi4;
646 __attrsFailEvaluation = true;
647 };
648
649 packages = recurseIntoAttrs (vanillaPackages // rtPackages // rpiPackages // {
650
651 # Intentionally lacks recurseIntoAttrs, as -rc kernels will quite likely break out-of-tree modules and cause failed Hydra builds.
652 linux_testing = packagesFor kernels.linux_testing;
653
654 linux_hardened = recurseIntoAttrs (packagesFor kernels.linux_hardened);
655
656 linux_4_19_hardened = recurseIntoAttrs (packagesFor kernels.linux_4_19_hardened);
657 linux_5_4_hardened = recurseIntoAttrs (packagesFor kernels.linux_5_4_hardened);
658 linux_5_10_hardened = recurseIntoAttrs (packagesFor kernels.linux_5_10_hardened);
659 linux_5_15_hardened = recurseIntoAttrs (packagesFor kernels.linux_5_15_hardened);
660 linux_6_1_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_1_hardened);
661 linux_6_6_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_6_hardened);
662 linux_6_8_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_8_hardened);
663 linux_6_9_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_9_hardened);
664
665 linux_zen = recurseIntoAttrs (packagesFor kernels.linux_zen);
666 linux_lqx = recurseIntoAttrs (packagesFor kernels.linux_lqx);
667 linux_xanmod = recurseIntoAttrs (packagesFor kernels.linux_xanmod);
668 linux_xanmod_stable = recurseIntoAttrs (packagesFor kernels.linux_xanmod_stable);
669 linux_xanmod_latest = recurseIntoAttrs (packagesFor kernels.linux_xanmod_latest);
670
671 linux_libre = recurseIntoAttrs (packagesFor kernels.linux_libre);
672
673 linux_latest_libre = recurseIntoAttrs (packagesFor kernels.linux_latest_libre);
674 __recurseIntoDerivationForReleaseJobs = true;
675 } // lib.optionalAttrs config.allowAliases {
676 linux_5_18_hardened = throw "linux 5.18 was removed because it has reached its end of life upstream";
677 linux_5_19_hardened = throw "linux 5.19 was removed because it has reached its end of life upstream";
678 linux_6_0_hardened = throw "linux 6.0 was removed because it has reached its end of life upstream";
679 linux_6_7_hardened = throw "linux 6.7 was removed because it has reached its end of life upstream";
680 linux_xanmod_tt = throw "linux_xanmod_tt was removed because upstream no longer offers this option";
681 });
682
683 packageAliases = {
684 linux_default = packages.linux_6_6;
685 # Update this when adding the newest kernel major version!
686 linux_latest = packages.linux_6_9;
687 linux_mptcp = throw "'linux_mptcp' has been moved to https://github.com/teto/mptcp-flake";
688 linux_rt_default = packages.linux_rt_5_15;
689 linux_rt_latest = packages.linux_rt_6_6;
690 } // { __attrsFailEvaluation = true; };
691
692 manualConfig = callPackage ../os-specific/linux/kernel/manual-config.nix {};
693
694 customPackage = { version, src, modDirVersion ? lib.versions.pad 3 version, configfile, allowImportFromDerivation ? true }:
695 recurseIntoAttrs (packagesFor (manualConfig {
696 inherit version src modDirVersion configfile allowImportFromDerivation;
697 }));
698
699 # Derive one of the default .config files
700 linuxConfig = {
701 src,
702 kernelPatches ? [],
703 version ? (builtins.parseDrvName src.name).version,
704 makeTarget ? "defconfig",
705 name ? "kernel.config",
706 }: stdenvNoCC.mkDerivation {
707 inherit name src;
708 depsBuildBuild = [ buildPackages.stdenv.cc ]
709 ++ lib.optionals (lib.versionAtLeast version "4.16") [ buildPackages.bison buildPackages.flex ];
710 patches = map (p: p.patch) kernelPatches; # Patches may include new configs.
711 postPatch = ''
712 patchShebangs scripts/
713 '';
714 buildPhase = ''
715 set -x
716 make \
717 ARCH=${stdenv.hostPlatform.linuxArch} \
718 HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \
719 ${makeTarget}
720 '';
721 installPhase = ''
722 cp .config $out
723 '';
724 };
725
726 buildLinux = callPackage ../os-specific/linux/kernel/generic.nix {};
727}