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