1{
2 pkgs,
3 linuxKernel,
4 config,
5 buildPackages,
6 callPackage,
7 makeOverridable,
8 recurseIntoAttrs,
9 dontRecurseIntoAttrs,
10 stdenv,
11 stdenvNoCC,
12 newScope,
13 lib,
14 fetchurl,
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 =
26 kernel:
27 callPackage ../os-specific/linux/kernel/linux-libre.nix {
28 linux = kernel;
29 };
30
31 markBroken =
32 drv:
33 drv.overrideAttrs (
34 {
35 meta ? { },
36 ...
37 }:
38 {
39 meta = meta // {
40 broken = true;
41 };
42 }
43 );
44
45 # Hardened Linux
46 hardenedKernelFor =
47 kernel': overrides:
48 let
49 kernel = kernel'.override overrides;
50 version = kernelPatches.hardened.${kernel.meta.branch}.version;
51 major = lib.versions.major version;
52 sha256 = kernelPatches.hardened.${kernel.meta.branch}.sha256;
53 modDirVersion' = builtins.replaceStrings [ kernel.version ] [ version ] kernel.modDirVersion;
54 in
55 kernel.override {
56 structuredExtraConfig = import ../os-specific/linux/kernel/hardened/config.nix {
57 inherit stdenv lib version;
58 };
59 argsOverride = {
60 inherit version;
61 pname = "linux-hardened";
62 modDirVersion = modDirVersion' + kernelPatches.hardened.${kernel.meta.branch}.extra;
63 src = fetchurl {
64 url = "mirror://kernel/linux/kernel/v${major}.x/linux-${version}.tar.xz";
65 inherit sha256;
66 };
67 extraMeta = {
68 broken = kernel.meta.broken;
69 };
70 };
71 kernelPatches = kernel.kernelPatches ++ [
72 kernelPatches.hardened.${kernel.meta.branch}
73 ];
74 isHardened = true;
75 };
76in
77{
78 kernelPatches = callPackage ../os-specific/linux/kernel/patches.nix { };
79
80 kernels = recurseIntoAttrs (
81 lib.makeExtensible (
82 self:
83 with self;
84 let
85 callPackage = newScope self;
86 in
87 {
88
89 # NOTE: PLEASE DO NOT ADD NEW DOWNSTREAM KERNELS TO NIXPKGS.
90 # New vendor kernels should go to nixos-hardware instead.
91 # e.g. https://github.com/NixOS/nixos-hardware/tree/master/microsoft/surface/kernel
92
93 linux_rpi1 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
94 kernelPatches = with kernelPatches; [
95 bridge_stp_helper
96 request_key_helper
97 ];
98 rpiVersion = 1;
99 };
100
101 linux_rpi2 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
102 kernelPatches = with kernelPatches; [
103 bridge_stp_helper
104 request_key_helper
105 ];
106 rpiVersion = 2;
107 };
108
109 linux_rpi3 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
110 kernelPatches = with kernelPatches; [
111 bridge_stp_helper
112 request_key_helper
113 ];
114 rpiVersion = 3;
115 };
116
117 linux_rpi4 = callPackage ../os-specific/linux/kernel/linux-rpi.nix {
118 kernelPatches = with kernelPatches; [
119 bridge_stp_helper
120 request_key_helper
121 ];
122 rpiVersion = 4;
123 };
124
125 linux_5_4 = callPackage ../os-specific/linux/kernel/mainline.nix {
126 branch = "5.4";
127 kernelPatches = [
128 kernelPatches.bridge_stp_helper
129 kernelPatches.request_key_helper
130 kernelPatches.rtl8761b_support
131 ];
132 };
133
134 linux_rt_5_4 = callPackage ../os-specific/linux/kernel/linux-rt-5.4.nix {
135 kernelPatches = [
136 kernelPatches.bridge_stp_helper
137 kernelPatches.request_key_helper
138 ];
139 };
140
141 linux_5_10 = callPackage ../os-specific/linux/kernel/mainline.nix {
142 branch = "5.10";
143 kernelPatches = [
144 kernelPatches.bridge_stp_helper
145 kernelPatches.request_key_helper
146 ];
147 };
148
149 linux_rt_5_10 = callPackage ../os-specific/linux/kernel/linux-rt-5.10.nix {
150 kernelPatches = [
151 kernelPatches.bridge_stp_helper
152 kernelPatches.request_key_helper
153 kernelPatches.export-rt-sched-migrate
154 ];
155 };
156
157 linux_5_15 = callPackage ../os-specific/linux/kernel/mainline.nix {
158 branch = "5.15";
159 kernelPatches = [
160 kernelPatches.bridge_stp_helper
161 kernelPatches.request_key_helper
162 ];
163 };
164
165 linux_rt_5_15 = callPackage ../os-specific/linux/kernel/linux-rt-5.15.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_1 = callPackage ../os-specific/linux/kernel/mainline.nix {
174 branch = "6.1";
175 kernelPatches = [
176 kernelPatches.bridge_stp_helper
177 kernelPatches.request_key_helper
178 ];
179 };
180
181 linux_rt_6_1 = callPackage ../os-specific/linux/kernel/linux-rt-6.1.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_6 = callPackage ../os-specific/linux/kernel/mainline.nix {
190 branch = "6.6";
191 kernelPatches = [
192 kernelPatches.bridge_stp_helper
193 kernelPatches.request_key_helper
194 ];
195 };
196
197 linux_rt_6_6 = callPackage ../os-specific/linux/kernel/linux-rt-6.6.nix {
198 kernelPatches = [
199 kernelPatches.bridge_stp_helper
200 kernelPatches.request_key_helper
201 kernelPatches.export-rt-sched-migrate
202 ];
203 };
204
205 linux_6_12 = callPackage ../os-specific/linux/kernel/mainline.nix {
206 branch = "6.12";
207 kernelPatches = [
208 kernelPatches.bridge_stp_helper
209 kernelPatches.request_key_helper
210 ];
211 };
212
213 linux_6_16 = callPackage ../os-specific/linux/kernel/mainline.nix {
214 branch = "6.16";
215 kernelPatches = [
216 kernelPatches.bridge_stp_helper
217 kernelPatches.request_key_helper
218 ];
219 };
220
221 linux_6_17 = callPackage ../os-specific/linux/kernel/mainline.nix {
222 branch = "6.17";
223 kernelPatches = [
224 kernelPatches.bridge_stp_helper
225 kernelPatches.request_key_helper
226 ];
227 };
228
229 linux_testing =
230 let
231 testing = callPackage ../os-specific/linux/kernel/mainline.nix {
232 # A special branch that tracks the kernel under the release process
233 # i.e. which has at least a public rc1 and is not released yet.
234 branch = "testing";
235 kernelPatches = [
236 kernelPatches.bridge_stp_helper
237 kernelPatches.request_key_helper
238 ];
239 };
240 latest = packageAliases.linux_latest.kernel;
241 in
242 if latest.kernelAtLeast testing.baseVersion then latest else testing;
243
244 linux_default = packageAliases.linux_default.kernel;
245
246 linux_latest = packageAliases.linux_latest.kernel;
247
248 # Using zenKernels like this due lqx&zen came from one source, but may have different base kernel version
249 # https://github.com/NixOS/nixpkgs/pull/161773#discussion_r820134708
250 zenKernels = callPackage ../os-specific/linux/kernel/zen-kernels.nix;
251
252 linux_zen = zenKernels {
253 variant = "zen";
254 kernelPatches = [
255 kernelPatches.bridge_stp_helper
256 kernelPatches.request_key_helper
257 ];
258 };
259
260 linux_lqx = zenKernels {
261 variant = "lqx";
262 kernelPatches = [
263 kernelPatches.bridge_stp_helper
264 kernelPatches.request_key_helper
265 ];
266 };
267
268 # This contains the variants of the XanMod kernel
269 xanmodKernels = callPackage ../os-specific/linux/kernel/xanmod-kernels.nix;
270
271 linux_xanmod = xanmodKernels {
272 variant = "lts";
273 kernelPatches = [
274 kernelPatches.bridge_stp_helper
275 kernelPatches.request_key_helper
276 ];
277 };
278 linux_xanmod_stable = xanmodKernels {
279 variant = "main";
280 kernelPatches = [
281 kernelPatches.bridge_stp_helper
282 kernelPatches.request_key_helper
283 ];
284 };
285 linux_xanmod_latest = xanmodKernels {
286 variant = "main";
287 kernelPatches = [
288 kernelPatches.bridge_stp_helper
289 kernelPatches.request_key_helper
290 ];
291 };
292
293 linux_libre = deblobKernel packageAliases.linux_default.kernel;
294
295 linux_latest_libre = deblobKernel packageAliases.linux_latest.kernel;
296
297 linux_6_12_hardened = hardenedKernelFor kernels.linux_6_12 { };
298
299 linux_hardened = hardenedKernelFor packageAliases.linux_default.kernel { };
300 }
301 // lib.optionalAttrs config.allowAliases {
302 linux_4_19 = throw "linux 4.19 was removed because it will reach its end of life within 24.11";
303 linux_6_9 = throw "linux 6.9 was removed because it has reached its end of life upstream";
304 linux_6_10 = throw "linux 6.10 was removed because it has reached its end of life upstream";
305 linux_6_11 = throw "linux 6.11 was removed because it has reached its end of life upstream";
306 linux_6_13 = throw "linux 6.13 was removed because it has reached its end of life upstream";
307 linux_6_14 = throw "linux 6.14 was removed because it has reached its end of life upstream";
308 linux_6_15 = throw "linux 6.15 was removed because it has reached its end of life upstream";
309
310 linux_5_10_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
311 linux_5_15_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
312 linux_6_1_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
313 linux_6_6_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
314
315 linux_4_19_hardened = throw "linux 4.19 was removed because it will reach its end of life within 24.11";
316 linux_5_4_hardened = throw "linux_5_4_hardened was removed because it was broken";
317 linux_6_9_hardened = throw "linux 6.9 was removed because it has reached its end of life upstream";
318 linux_6_10_hardened = throw "linux 6.10 was removed because it has reached its end of life upstream";
319 linux_6_11_hardened = throw "linux 6.11 was removed because it has reached its end of life upstream";
320 linux_6_13_hardened = throw "linux 6.13 was removed because it has reached its end of life upstream";
321 linux_6_14_hardened = throw "linux 6.14 was removed because it has reached its end of life upstream";
322 linux_6_15_hardened = throw "linux 6.15 was removed because it has reached its end of life upstream";
323
324 linux_ham = throw "linux_ham has been removed in favour of the standard kernel packages";
325 }
326 )
327 );
328 /*
329 Linux kernel modules are inherently tied to a specific kernel. So
330 rather than provide specific instances of those packages for a
331 specific kernel, we have a function that builds those packages
332 for a specific kernel. This function can then be called for
333 whatever kernel you're using.
334 */
335
336 packagesFor =
337 kernel_:
338 lib.makeExtensible (
339 self:
340 with self;
341 let
342 callPackage = newScope self;
343 in
344 {
345 inherit callPackage;
346 kernel = kernel_;
347 inherit (kernel) stdenv; # in particular, use the same compiler by default
348
349 # to help determine module compatibility
350 inherit (kernel)
351 isLTS
352 isZen
353 isHardened
354 isLibre
355 ;
356 inherit (kernel) kernelOlder kernelAtLeast;
357 kernelModuleMakeFlags = self.kernel.commonMakeFlags ++ [
358 "KBUILD_OUTPUT=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
359 ];
360 # Obsolete aliases (these packages do not depend on the kernel).
361 inherit (pkgs) odp-dpdk pktgen; # added 2018-05
362 inherit (pkgs) bcc bpftrace; # added 2021-12
363 inherit (pkgs) oci-seccomp-bpf-hook; # added 2022-11
364 inherit (pkgs) dpdk; # added 2024-03
365
366 acer-wmi-battery = callPackage ../os-specific/linux/acer-wmi-battery { };
367
368 acpi_call = callPackage ../os-specific/linux/acpi-call { };
369
370 ajantv2 = callPackage ../os-specific/linux/ajantv2 { };
371
372 akvcam = callPackage ../os-specific/linux/akvcam { };
373
374 amdgpu-i2c = callPackage ../os-specific/linux/amdgpu-i2c { };
375
376 amneziawg = callPackage ../os-specific/linux/amneziawg { };
377
378 apfs = callPackage ../os-specific/linux/apfs { };
379
380 ax99100 = callPackage ../os-specific/linux/ax99100 { };
381
382 batman_adv = callPackage ../os-specific/linux/batman-adv { };
383
384 bbswitch = callPackage ../os-specific/linux/bbswitch { };
385
386 # NOTE: The bcachefs module is called this way to facilitate
387 # easy overriding, as it is expected many users will want to
388 # pull from the upstream git repo, which may include
389 # unreleased changes to the module build process.
390 bcachefs = callPackage pkgs.bcachefs-tools.kernelModule { };
391
392 ch9344 = callPackage ../os-specific/linux/ch9344 { };
393
394 chipsec = callPackage ../tools/security/chipsec {
395 inherit kernel;
396 withDriver = true;
397 };
398
399 cryptodev = callPackage ../os-specific/linux/cryptodev { };
400
401 cpupower = callPackage ../os-specific/linux/cpupower { };
402
403 ddcci-driver = callPackage ../os-specific/linux/ddcci { };
404
405 dddvb = callPackage ../os-specific/linux/dddvb { };
406
407 decklink = callPackage ../os-specific/linux/decklink { };
408
409 digimend = callPackage ../os-specific/linux/digimend { };
410
411 dpdk-kmods = callPackage ../os-specific/linux/dpdk-kmods { };
412
413 ecapture = callPackage ../by-name/ec/ecapture/package.nix {
414 withNonBTF = true;
415 inherit kernel;
416 };
417
418 exfat-nofuse =
419 if lib.versionOlder kernel.version "5.8" then callPackage ../os-specific/linux/exfat { } else null;
420
421 evdi = callPackage ../os-specific/linux/evdi { };
422
423 fanout = callPackage ../os-specific/linux/fanout { };
424
425 framework-laptop-kmod = callPackage ../os-specific/linux/framework-laptop-kmod { };
426
427 fwts-efi-runtime = callPackage ../os-specific/linux/fwts/module.nix { };
428
429 gasket = callPackage ../os-specific/linux/gasket { };
430
431 gcadapter-oc-kmod = callPackage ../os-specific/linux/gcadapter-oc-kmod { };
432
433 hyperv-daemons = callPackage ../os-specific/linux/hyperv-daemons { };
434
435 e1000e =
436 if lib.versionOlder kernel.version "4.10" then
437 callPackage ../os-specific/linux/e1000e { }
438 else
439 null;
440
441 iio-utils =
442 if lib.versionAtLeast kernel.version "4.1" then
443 callPackage ../os-specific/linux/iio-utils { }
444 else
445 null;
446
447 intel-speed-select =
448 if lib.versionAtLeast kernel.version "5.3" then
449 callPackage ../os-specific/linux/intel-speed-select { }
450 else
451 null;
452
453 ipu6-drivers = callPackage ../os-specific/linux/ipu6-drivers { };
454
455 ivsc-driver = callPackage ../os-specific/linux/ivsc-driver { };
456
457 ixgbevf = callPackage ../os-specific/linux/ixgbevf { };
458
459 it87 = callPackage ../os-specific/linux/it87 { };
460
461 asus-ec-sensors = callPackage ../os-specific/linux/asus-ec-sensors { };
462
463 ena = callPackage ../os-specific/linux/ena { };
464
465 lenovo-legion-module = callPackage ../os-specific/linux/lenovo-legion { };
466
467 linux-gpib = callPackage ../applications/science/electronics/linux-gpib/kernel.nix { };
468
469 liquidtux = callPackage ../os-specific/linux/liquidtux { };
470
471 lkrg = callPackage ../os-specific/linux/lkrg { };
472
473 v4l2loopback = callPackage ../os-specific/linux/v4l2loopback { };
474
475 lttng-modules = callPackage ../os-specific/linux/lttng-modules { };
476
477 mstflint_access = callPackage ../os-specific/linux/mstflint_access { };
478
479 broadcom_sta = callPackage ../os-specific/linux/broadcom-sta { };
480
481 tbs = callPackage ../os-specific/linux/tbs { };
482
483 mbp2018-bridge-drv = callPackage ../os-specific/linux/mbp-modules/mbp2018-bridge-drv { };
484
485 nct6687d = callPackage ../os-specific/linux/nct6687d { };
486
487 new-lg4ff = callPackage ../os-specific/linux/new-lg4ff { };
488
489 zenergy = callPackage ../os-specific/linux/zenergy { };
490
491 nvidiabl = callPackage ../os-specific/linux/nvidiabl { };
492
493 nvidiaPackages = dontRecurseIntoAttrs (
494 lib.makeExtensible (_: callPackage ../os-specific/linux/nvidia-x11 { })
495 );
496
497 nvidia_x11 = nvidiaPackages.stable;
498 nvidia_x11_beta = nvidiaPackages.beta;
499 nvidia_x11_latest = nvidiaPackages.latest;
500 nvidia_x11_legacy340 = nvidiaPackages.legacy_340;
501 nvidia_x11_legacy390 = nvidiaPackages.legacy_390;
502 nvidia_x11_legacy470 = nvidiaPackages.legacy_470;
503 nvidia_x11_legacy535 = nvidiaPackages.legacy_535;
504 nvidia_x11_production = nvidiaPackages.production;
505 nvidia_x11_vulkan_beta = nvidiaPackages.vulkan_beta;
506 nvidia_dc = nvidiaPackages.dc;
507 nvidia_dc_535 = nvidiaPackages.dc_535;
508 nvidia_dc_565 = nvidiaPackages.dc_565;
509
510 # this is not a replacement for nvidia_x11*
511 # only the opensource kernel driver exposed for hydra to build
512 nvidia_x11_beta_open = nvidiaPackages.beta.open;
513 nvidia_x11_latest_open = nvidiaPackages.latest.open;
514 nvidia_x11_production_open = nvidiaPackages.production.open;
515 nvidia_x11_stable_open = nvidiaPackages.stable.open;
516 nvidia_x11_vulkan_beta_open = nvidiaPackages.vulkan_beta.open;
517
518 nxp-pn5xx = callPackage ../os-specific/linux/nxp-pn5xx { };
519
520 openrazer = callPackage ../os-specific/linux/openrazer/driver.nix { };
521
522 ply = callPackage ../os-specific/linux/ply { };
523
524 r8125 = callPackage ../os-specific/linux/r8125 { };
525
526 r8168 = callPackage ../os-specific/linux/r8168 { };
527
528 rtl8188eus-aircrack = callPackage ../os-specific/linux/rtl8188eus-aircrack { };
529
530 rtl8192eu = callPackage ../os-specific/linux/rtl8192eu { };
531
532 rtl8189es = callPackage ../os-specific/linux/rtl8189es { };
533
534 rtl8189fs = callPackage ../os-specific/linux/rtl8189fs { };
535
536 rtl8723ds = callPackage ../os-specific/linux/rtl8723ds { };
537
538 rtl8812au = callPackage ../os-specific/linux/rtl8812au { };
539
540 rtl8814au = callPackage ../os-specific/linux/rtl8814au { };
541
542 rtl8852au = callPackage ../os-specific/linux/rtl8852au { };
543
544 rtl8852bu = callPackage ../os-specific/linux/rtl8852bu { };
545
546 rtl88xxau-aircrack = callPackage ../os-specific/linux/rtl88xxau-aircrack { };
547
548 rtl8821au = callPackage ../os-specific/linux/rtl8821au { };
549
550 rtl8821ce = callPackage ../os-specific/linux/rtl8821ce { };
551
552 rtl88x2bu = callPackage ../os-specific/linux/rtl88x2bu { };
553
554 rtl8821cu = callPackage ../os-specific/linux/rtl8821cu { };
555
556 rtw88 = callPackage ../os-specific/linux/rtw88 { };
557
558 rtw89 =
559 if lib.versionOlder kernel.version "5.16" then callPackage ../os-specific/linux/rtw89 { } else null;
560
561 openafs_1_8 = callPackage ../servers/openafs/1.8/module.nix { };
562 # Current stable release; don't backport release updates!
563 openafs = openafs_1_8;
564
565 opensnitch-ebpf =
566 if lib.versionAtLeast kernel.version "5.10" then
567 callPackage ../os-specific/linux/opensnitch-ebpf { }
568 else
569 null;
570
571 facetimehd = callPackage ../os-specific/linux/facetimehd { };
572
573 rust-out-of-tree-module =
574 if lib.versionAtLeast kernel.version "6.7" then
575 callPackage ../os-specific/linux/rust-out-of-tree-module { }
576 else
577 null;
578
579 tuxedo-drivers =
580 if lib.versionAtLeast kernel.version "4.14" then
581 callPackage ../os-specific/linux/tuxedo-drivers { }
582 else
583 null;
584
585 jool = callPackage ../os-specific/linux/jool { };
586
587 kvmfr = callPackage ../os-specific/linux/kvmfr { };
588
589 mba6x_bl = callPackage ../os-specific/linux/mba6x_bl { };
590
591 mwprocapture = callPackage ../os-specific/linux/mwprocapture { };
592
593 mxu11x0 = callPackage ../os-specific/linux/mxu11x0 { };
594
595 # compiles but has to be integrated into the kernel somehow
596 # Let's have it uncommented and finish it..
597 ndiswrapper = callPackage ../os-specific/linux/ndiswrapper { };
598
599 netatop = callPackage ../os-specific/linux/netatop { };
600
601 prl-tools = callPackage ../os-specific/linux/prl-tools { };
602
603 isgx = callPackage ../os-specific/linux/isgx { };
604
605 rr-zen_workaround = callPackage ../development/tools/analysis/rr/zen_workaround.nix { };
606
607 sheep-net = callPackage ../os-specific/linux/sheep-net { };
608
609 shufflecake = callPackage ../os-specific/linux/shufflecake { };
610
611 sysdig = callPackage ../os-specific/linux/sysdig { };
612
613 systemtap = callPackage ../development/tools/profiling/systemtap { };
614
615 system76 = callPackage ../os-specific/linux/system76 { };
616
617 system76-acpi = callPackage ../os-specific/linux/system76-acpi { };
618
619 system76-io = callPackage ../os-specific/linux/system76-io { };
620
621 tmon = callPackage ../os-specific/linux/tmon { };
622
623 tp_smapi = callPackage ../os-specific/linux/tp_smapi { };
624
625 tt-kmd = callPackage ../os-specific/linux/tt-kmd { };
626
627 turbostat = callPackage ../os-specific/linux/turbostat { };
628
629 corefreq = callPackage ../os-specific/linux/corefreq { };
630
631 trelay = callPackage ../os-specific/linux/trelay { };
632
633 universal-pidff = callPackage ../os-specific/linux/universal-pidff { };
634
635 usbip = callPackage ../os-specific/linux/usbip { };
636
637 v86d = callPackage ../os-specific/linux/v86d { };
638
639 veikk-linux-driver = callPackage ../os-specific/linux/veikk-linux-driver { };
640 vendor-reset = callPackage ../os-specific/linux/vendor-reset { };
641
642 vhba = callPackage ../applications/emulators/cdemu/vhba.nix { };
643
644 virtio_vmmci = callPackage ../os-specific/linux/virtio_vmmci { };
645
646 virtualbox = callPackage ../os-specific/linux/virtualbox {
647 virtualbox = pkgs.virtualboxHardened;
648 };
649
650 virtualboxGuestAdditions =
651 callPackage ../applications/virtualization/virtualbox/guest-additions
652 { };
653
654 mm-tools = callPackage ../os-specific/linux/mm-tools { };
655
656 vmm_clock = callPackage ../os-specific/linux/vmm_clock { };
657
658 vmware = callPackage ../os-specific/linux/vmware { };
659
660 wireguard =
661 if lib.versionOlder kernel.version "5.6" then
662 callPackage ../os-specific/linux/wireguard { }
663 else
664 null;
665
666 x86_energy_perf_policy = callPackage ../os-specific/linux/x86_energy_perf_policy { };
667
668 xone =
669 if lib.versionAtLeast kernel.version "5.4" then callPackage ../os-specific/linux/xone { } else null;
670
671 xpadneo = callPackage ../os-specific/linux/xpadneo { };
672
673 yt6801 = callPackage ../os-specific/linux/yt6801 { };
674
675 ithc = callPackage ../os-specific/linux/ithc { };
676
677 ryzen-smu = callPackage ../os-specific/linux/ryzen-smu { };
678
679 zenpower = callPackage ../os-specific/linux/zenpower { };
680
681 zfs_2_2 = callPackage ../os-specific/linux/zfs/2_2.nix {
682 configFile = "kernel";
683 inherit pkgs kernel;
684 };
685 zfs_2_3 = callPackage ../os-specific/linux/zfs/2_3.nix {
686 configFile = "kernel";
687 inherit pkgs kernel;
688 };
689 zfs_unstable = callPackage ../os-specific/linux/zfs/unstable.nix {
690 configFile = "kernel";
691 inherit pkgs kernel;
692 };
693
694 can-isotp = callPackage ../os-specific/linux/can-isotp { };
695
696 qc71_laptop = callPackage ../os-specific/linux/qc71_laptop { };
697
698 hid-ite8291r3 = callPackage ../os-specific/linux/hid-ite8291r3 { };
699
700 hid-t150 = callPackage ../os-specific/linux/hid-t150 { };
701
702 hid-tmff2 = callPackage ../os-specific/linux/hid-tmff2 { };
703
704 hpuefi-mod = callPackage ../os-specific/linux/hpuefi-mod { };
705
706 drbd = callPackage ../os-specific/linux/drbd/driver.nix { };
707
708 nullfs = callPackage ../os-specific/linux/nullfs { };
709
710 msi-ec = callPackage ../os-specific/linux/msi-ec { };
711
712 tsme-test = callPackage ../os-specific/linux/tsme-test { };
713
714 xpad-noone = callPackage ../os-specific/linux/xpad-noone { };
715
716 }
717 // lib.optionalAttrs config.allowAliases {
718 zfs = throw "linuxPackages.zfs has been removed, use zfs_* instead, or linuxPackages.\${pkgs.zfs.kernelModuleAttribute}"; # added 2025-01-23
719 zfs_2_1 = throw "zfs_2_1 has been removed"; # added 2024-12-25;
720 ati_drivers_x11 = throw "ati drivers are no longer supported by any kernel >=4.1"; # added 2021-05-18;
721 deepin-anything-module = throw "the Deepin desktop environment and associated tools have been removed from nixpkgs due to lack of maintenance";
722 hid-nintendo = throw "hid-nintendo was added in mainline kernel version 5.16"; # Added 2023-07-30
723 sch_cake = throw "sch_cake was added in mainline kernel version 4.19"; # Added 2023-06-14
724 rtl8723bs = throw "rtl8723bs was added in mainline kernel version 4.12"; # Added 2023-06-14
725 vm-tools = self.mm-tools;
726 xmm7360-pci = throw "Support for the XMM7360 WWAN card was added to the iosm kmod in mainline kernel version 5.18";
727 amdgpu-pro = throw "amdgpu-pro was removed due to lack of maintenance"; # Added 2024-06-16
728 kvdo = throw "kvdo was removed, because it was added to mainline in kernel version 6.9"; # Added 2024-07-08
729 perf = lib.warnOnInstantiate "linuxPackages.perf is now perf" pkgs.perf; # Added 2025-08-28
730 system76-power = lib.warnOnInstantiate "kernelPackages.system76-power is now pkgs.system76-power" pkgs.system76-power; # Added 2024-10-16
731 system76-scheduler = lib.warnOnInstantiate "kernelPackages.system76-scheduler is now pkgs.system76-scheduler" pkgs.system76-scheduler; # Added 2024-10-16
732 tuxedo-keyboard = self.tuxedo-drivers; # Added 2024-09-28
733 phc-intel = throw "phc-intel drivers are no longer supported by any kernel >=4.17"; # added 2025-07-18
734 }
735 );
736
737 hardenedPackagesFor = kernel: overrides: packagesFor (hardenedKernelFor kernel overrides);
738
739 vanillaPackages = {
740 # recurse to build modules for the kernels
741 linux_5_4 = recurseIntoAttrs (packagesFor kernels.linux_5_4);
742 linux_5_10 = recurseIntoAttrs (packagesFor kernels.linux_5_10);
743 linux_5_15 = recurseIntoAttrs (packagesFor kernels.linux_5_15);
744 linux_6_1 = recurseIntoAttrs (packagesFor kernels.linux_6_1);
745 linux_6_6 = recurseIntoAttrs (packagesFor kernels.linux_6_6);
746 linux_6_12 = recurseIntoAttrs (packagesFor kernels.linux_6_12);
747 linux_6_16 = recurseIntoAttrs (packagesFor kernels.linux_6_16);
748 linux_6_17 = recurseIntoAttrs (packagesFor kernels.linux_6_17);
749 }
750 // lib.optionalAttrs config.allowAliases {
751 linux_4_19 = throw "linux 4.19 was removed because it will reach its end of life within 24.11"; # Added 2024-09-21
752 linux_6_9 = throw "linux 6.9 was removed because it reached its end of life upstream"; # Added 2024-08-02
753 linux_6_10 = throw "linux 6.10 was removed because it reached its end of life upstream"; # Added 2024-10-23
754 linux_6_11 = throw "linux 6.11 was removed because it reached its end of life upstream"; # Added 2025-03-23
755 linux_6_13 = throw "linux 6.13 was removed because it reached its end of life upstream"; # Added 2025-06-22
756 linux_6_14 = throw "linux 6.14 was removed because it reached its end of life upstream"; # Added 2025-06-22
757 linux_6_15 = throw "linux 6.15 was removed because it reached its end of life upstream"; # Added 2025-08-23
758 };
759
760 rtPackages = {
761 # realtime kernel packages
762 linux_rt_5_4 = packagesFor kernels.linux_rt_5_4;
763 linux_rt_5_10 = packagesFor kernels.linux_rt_5_10;
764 linux_rt_5_15 = packagesFor kernels.linux_rt_5_15;
765 linux_rt_6_1 = packagesFor kernels.linux_rt_6_1;
766 linux_rt_6_6 = packagesFor kernels.linux_rt_6_6;
767 };
768
769 rpiPackages = {
770 linux_rpi1 = packagesFor kernels.linux_rpi1;
771 linux_rpi2 = packagesFor kernels.linux_rpi2;
772 linux_rpi3 = packagesFor kernels.linux_rpi3;
773 linux_rpi4 = packagesFor kernels.linux_rpi4;
774 };
775
776 packages = recurseIntoAttrs (
777 vanillaPackages
778 // rtPackages
779 // rpiPackages
780 // {
781
782 # Intentionally lacks recurseIntoAttrs, as -rc kernels will quite likely break out-of-tree modules and cause failed Hydra builds.
783 linux_testing = packagesFor kernels.linux_testing;
784
785 linux_hardened = recurseIntoAttrs (packagesFor kernels.linux_hardened);
786
787 linux_6_12_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_12_hardened);
788
789 linux_zen = recurseIntoAttrs (packagesFor kernels.linux_zen);
790 linux_lqx = recurseIntoAttrs (packagesFor kernels.linux_lqx);
791 linux_xanmod = recurseIntoAttrs (packagesFor kernels.linux_xanmod);
792 linux_xanmod_stable = recurseIntoAttrs (packagesFor kernels.linux_xanmod_stable);
793 linux_xanmod_latest = recurseIntoAttrs (packagesFor kernels.linux_xanmod_latest);
794
795 linux_libre = recurseIntoAttrs (packagesFor kernels.linux_libre);
796
797 linux_latest_libre = recurseIntoAttrs (packagesFor kernels.linux_latest_libre);
798 }
799 // lib.optionalAttrs config.allowAliases {
800
801 linux_5_10_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
802 linux_5_15_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
803 linux_6_1_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
804 linux_6_6_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
805
806 linux_4_19_hardened = throw "linux 4.19 was removed because it will reach its end of life within 24.11";
807 linux_5_4_hardened = throw "linux_5_4_hardened was removed because it was broken";
808 linux_6_9_hardened = throw "linux 6.9 was removed because it has reached its end of life upstream";
809 linux_6_10_hardened = throw "linux 6.10 was removed because it has reached its end of life upstream";
810 linux_6_11_hardened = throw "linux 6.11 was removed because it has reached its end of life upstream";
811 linux_6_13_hardened = throw "linux 6.13 was removed because it has reached its end of life upstream";
812 linux_6_14_hardened = throw "linux 6.14 was removed because it has reached its end of life upstream";
813 linux_6_15_hardened = throw "linux 6.15 was removed because it has reached its end of life upstream";
814 linux_ham = throw "linux_ham has been removed in favour of the standard kernel packages";
815 }
816 );
817
818 packageAliases = {
819 linux_default = packages.linux_6_12;
820 # Update this when adding the newest kernel major version!
821 linux_latest = packages.linux_6_17;
822 linux_rt_default = packages.linux_rt_5_15;
823 linux_rt_latest = packages.linux_rt_6_6;
824 }
825 // lib.optionalAttrs config.allowAliases {
826 linux_mptcp = throw "'linux_mptcp' has been moved to https://github.com/teto/mptcp-flake";
827 };
828
829 manualConfig = callPackage ../os-specific/linux/kernel/manual-config.nix { };
830
831 customPackage =
832 {
833 version,
834 src,
835 modDirVersion ? lib.versions.pad 3 version,
836 configfile,
837 allowImportFromDerivation ? false,
838 }:
839 recurseIntoAttrs (
840 packagesFor (manualConfig {
841 inherit
842 version
843 src
844 modDirVersion
845 configfile
846 allowImportFromDerivation
847 ;
848 })
849 );
850
851 # Derive one of the default .config files
852 linuxConfig =
853 {
854 src,
855 kernelPatches ? [ ],
856 version ? (builtins.parseDrvName src.name).version,
857 makeTarget ? "defconfig",
858 name ? "kernel.config",
859 }:
860 stdenvNoCC.mkDerivation {
861 inherit name src;
862 depsBuildBuild = [
863 buildPackages.stdenv.cc
864 ]
865 ++ lib.optionals (lib.versionAtLeast version "4.16") [
866 buildPackages.bison
867 buildPackages.flex
868 ];
869 patches = map (p: p.patch) kernelPatches; # Patches may include new configs.
870 postPatch = ''
871 patchShebangs scripts/
872 '';
873 buildPhase = ''
874 set -x
875 make \
876 ARCH=${stdenv.hostPlatform.linuxArch} \
877 HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \
878 ${makeTarget}
879 '';
880 installPhase = ''
881 cp .config $out
882 '';
883 };
884
885 buildLinux = callPackage ../os-specific/linux/kernel/generic.nix { };
886}