Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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_15 = callPackage ../os-specific/linux/kernel/mainline.nix {
214 branch = "6.15";
215 kernelPatches = [
216 kernelPatches.bridge_stp_helper
217 kernelPatches.request_key_helper
218 ];
219 };
220
221 linux_6_16 = callPackage ../os-specific/linux/kernel/mainline.nix {
222 branch = "6.16";
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 linux_6_15_hardened = hardenedKernelFor kernels.linux_6_15 { };
299
300 linux_hardened = hardenedKernelFor packageAliases.linux_default.kernel { };
301 }
302 // lib.optionalAttrs config.allowAliases {
303 linux_4_19 = throw "linux 4.19 was removed because it will reach its end of life within 24.11";
304 linux_6_9 = throw "linux 6.9 was removed because it has reached its end of life upstream";
305 linux_6_10 = throw "linux 6.10 was removed because it has reached its end of life upstream";
306 linux_6_11 = throw "linux 6.11 was removed because it has reached its end of life upstream";
307 linux_6_13 = throw "linux 6.13 was removed because it has reached its end of life upstream";
308 linux_6_14 = throw "linux 6.14 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
323 linux_ham = throw "linux_ham has been removed in favour of the standard kernel packages";
324 }
325 )
326 );
327 /*
328 Linux kernel modules are inherently tied to a specific kernel. So
329 rather than provide specific instances of those packages for a
330 specific kernel, we have a function that builds those packages
331 for a specific kernel. This function can then be called for
332 whatever kernel you're using.
333 */
334
335 packagesFor =
336 kernel_:
337 lib.makeExtensible (
338 self:
339 with self;
340 let
341 callPackage = newScope self;
342 in
343 {
344 inherit callPackage;
345 kernel = kernel_;
346 inherit (kernel) stdenv; # in particular, use the same compiler by default
347
348 # to help determine module compatibility
349 inherit (kernel)
350 isLTS
351 isZen
352 isHardened
353 isLibre
354 ;
355 inherit (kernel) kernelOlder kernelAtLeast;
356 kernelModuleMakeFlags = self.kernel.commonMakeFlags ++ [
357 "KBUILD_OUTPUT=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
358 ];
359 # Obsolete aliases (these packages do not depend on the kernel).
360 inherit (pkgs) odp-dpdk pktgen; # added 2018-05
361 inherit (pkgs) bcc bpftrace; # added 2021-12
362 inherit (pkgs) oci-seccomp-bpf-hook; # added 2022-11
363 inherit (pkgs) dpdk; # added 2024-03
364
365 acer-wmi-battery = callPackage ../os-specific/linux/acer-wmi-battery { };
366
367 acpi_call = callPackage ../os-specific/linux/acpi-call { };
368
369 ajantv2 = callPackage ../os-specific/linux/ajantv2 { };
370
371 akvcam = callPackage ../os-specific/linux/akvcam { };
372
373 amdgpu-i2c = callPackage ../os-specific/linux/amdgpu-i2c { };
374
375 amneziawg = callPackage ../os-specific/linux/amneziawg { };
376
377 apfs = callPackage ../os-specific/linux/apfs { };
378
379 ax99100 = callPackage ../os-specific/linux/ax99100 { };
380
381 batman_adv = callPackage ../os-specific/linux/batman-adv { };
382
383 bbswitch = callPackage ../os-specific/linux/bbswitch { };
384
385 ch9344 = callPackage ../os-specific/linux/ch9344 { };
386
387 chipsec = callPackage ../tools/security/chipsec {
388 inherit kernel;
389 withDriver = true;
390 };
391
392 cryptodev = callPackage ../os-specific/linux/cryptodev { };
393
394 cpupower = callPackage ../os-specific/linux/cpupower { };
395
396 ddcci-driver = callPackage ../os-specific/linux/ddcci { };
397
398 dddvb = callPackage ../os-specific/linux/dddvb { };
399
400 decklink = callPackage ../os-specific/linux/decklink { };
401
402 digimend = callPackage ../os-specific/linux/digimend { };
403
404 dpdk-kmods = callPackage ../os-specific/linux/dpdk-kmods { };
405
406 ecapture = callPackage ../by-name/ec/ecapture/package.nix {
407 withNonBTF = true;
408 inherit kernel;
409 };
410
411 exfat-nofuse =
412 if lib.versionOlder kernel.version "5.8" then callPackage ../os-specific/linux/exfat { } else null;
413
414 evdi = callPackage ../os-specific/linux/evdi { };
415
416 fanout = callPackage ../os-specific/linux/fanout { };
417
418 framework-laptop-kmod = callPackage ../os-specific/linux/framework-laptop-kmod { };
419
420 fwts-efi-runtime = callPackage ../os-specific/linux/fwts/module.nix { };
421
422 gasket = callPackage ../os-specific/linux/gasket { };
423
424 gcadapter-oc-kmod = callPackage ../os-specific/linux/gcadapter-oc-kmod { };
425
426 hyperv-daemons = callPackage ../os-specific/linux/hyperv-daemons { };
427
428 e1000e =
429 if lib.versionOlder kernel.version "4.10" then
430 callPackage ../os-specific/linux/e1000e { }
431 else
432 null;
433
434 iio-utils =
435 if lib.versionAtLeast kernel.version "4.1" then
436 callPackage ../os-specific/linux/iio-utils { }
437 else
438 null;
439
440 intel-speed-select =
441 if lib.versionAtLeast kernel.version "5.3" then
442 callPackage ../os-specific/linux/intel-speed-select { }
443 else
444 null;
445
446 ipu6-drivers = callPackage ../os-specific/linux/ipu6-drivers { };
447
448 ivsc-driver = callPackage ../os-specific/linux/ivsc-driver { };
449
450 ixgbevf = callPackage ../os-specific/linux/ixgbevf { };
451
452 it87 = callPackage ../os-specific/linux/it87 { };
453
454 asus-ec-sensors = callPackage ../os-specific/linux/asus-ec-sensors { };
455
456 ena = callPackage ../os-specific/linux/ena { };
457
458 lenovo-legion-module = callPackage ../os-specific/linux/lenovo-legion { };
459
460 linux-gpib = callPackage ../applications/science/electronics/linux-gpib/kernel.nix { };
461
462 liquidtux = callPackage ../os-specific/linux/liquidtux { };
463
464 lkrg = callPackage ../os-specific/linux/lkrg { };
465
466 v4l2loopback = callPackage ../os-specific/linux/v4l2loopback { };
467
468 lttng-modules = callPackage ../os-specific/linux/lttng-modules { };
469
470 mstflint_access = callPackage ../os-specific/linux/mstflint_access { };
471
472 broadcom_sta = callPackage ../os-specific/linux/broadcom-sta { };
473
474 tbs = callPackage ../os-specific/linux/tbs { };
475
476 mbp2018-bridge-drv = callPackage ../os-specific/linux/mbp-modules/mbp2018-bridge-drv { };
477
478 nct6687d = callPackage ../os-specific/linux/nct6687d { };
479
480 new-lg4ff = callPackage ../os-specific/linux/new-lg4ff { };
481
482 zenergy = callPackage ../os-specific/linux/zenergy { };
483
484 nvidiabl = callPackage ../os-specific/linux/nvidiabl { };
485
486 nvidiaPackages = dontRecurseIntoAttrs (
487 lib.makeExtensible (_: callPackage ../os-specific/linux/nvidia-x11 { })
488 );
489
490 nvidia_x11 = nvidiaPackages.stable;
491 nvidia_x11_beta = nvidiaPackages.beta;
492 nvidia_x11_latest = nvidiaPackages.latest;
493 nvidia_x11_legacy340 = nvidiaPackages.legacy_340;
494 nvidia_x11_legacy390 = nvidiaPackages.legacy_390;
495 nvidia_x11_legacy470 = nvidiaPackages.legacy_470;
496 nvidia_x11_legacy535 = nvidiaPackages.legacy_535;
497 nvidia_x11_production = nvidiaPackages.production;
498 nvidia_x11_vulkan_beta = nvidiaPackages.vulkan_beta;
499 nvidia_dc = nvidiaPackages.dc;
500 nvidia_dc_535 = nvidiaPackages.dc_535;
501 nvidia_dc_565 = nvidiaPackages.dc_565;
502
503 # this is not a replacement for nvidia_x11*
504 # only the opensource kernel driver exposed for hydra to build
505 nvidia_x11_beta_open = nvidiaPackages.beta.open;
506 nvidia_x11_latest_open = nvidiaPackages.latest.open;
507 nvidia_x11_production_open = nvidiaPackages.production.open;
508 nvidia_x11_stable_open = nvidiaPackages.stable.open;
509 nvidia_x11_vulkan_beta_open = nvidiaPackages.vulkan_beta.open;
510
511 nxp-pn5xx = callPackage ../os-specific/linux/nxp-pn5xx { };
512
513 openrazer = callPackage ../os-specific/linux/openrazer/driver.nix { };
514
515 ply = callPackage ../os-specific/linux/ply { };
516
517 r8125 = callPackage ../os-specific/linux/r8125 { };
518
519 r8168 = callPackage ../os-specific/linux/r8168 { };
520
521 rtl8188eus-aircrack = callPackage ../os-specific/linux/rtl8188eus-aircrack { };
522
523 rtl8192eu = callPackage ../os-specific/linux/rtl8192eu { };
524
525 rtl8189es = callPackage ../os-specific/linux/rtl8189es { };
526
527 rtl8189fs = callPackage ../os-specific/linux/rtl8189fs { };
528
529 rtl8723ds = callPackage ../os-specific/linux/rtl8723ds { };
530
531 rtl8812au = callPackage ../os-specific/linux/rtl8812au { };
532
533 rtl8814au = callPackage ../os-specific/linux/rtl8814au { };
534
535 rtl8852au = callPackage ../os-specific/linux/rtl8852au { };
536
537 rtl8852bu = callPackage ../os-specific/linux/rtl8852bu { };
538
539 rtl88xxau-aircrack = callPackage ../os-specific/linux/rtl88xxau-aircrack { };
540
541 rtl8821au = callPackage ../os-specific/linux/rtl8821au { };
542
543 rtl8821ce = callPackage ../os-specific/linux/rtl8821ce { };
544
545 rtl88x2bu = callPackage ../os-specific/linux/rtl88x2bu { };
546
547 rtl8821cu = callPackage ../os-specific/linux/rtl8821cu { };
548
549 rtw88 = callPackage ../os-specific/linux/rtw88 { };
550
551 rtw89 =
552 if lib.versionOlder kernel.version "5.16" then callPackage ../os-specific/linux/rtw89 { } else null;
553
554 openafs_1_8 = callPackage ../servers/openafs/1.8/module.nix { };
555 # Current stable release; don't backport release updates!
556 openafs = openafs_1_8;
557
558 opensnitch-ebpf =
559 if lib.versionAtLeast kernel.version "5.10" then
560 callPackage ../os-specific/linux/opensnitch-ebpf { }
561 else
562 null;
563
564 facetimehd = callPackage ../os-specific/linux/facetimehd { };
565
566 rust-out-of-tree-module =
567 if lib.versionAtLeast kernel.version "6.7" then
568 callPackage ../os-specific/linux/rust-out-of-tree-module { }
569 else
570 null;
571
572 tuxedo-drivers =
573 if lib.versionAtLeast kernel.version "4.14" then
574 callPackage ../os-specific/linux/tuxedo-drivers { }
575 else
576 null;
577
578 jool = callPackage ../os-specific/linux/jool { };
579
580 kvmfr = callPackage ../os-specific/linux/kvmfr { };
581
582 mba6x_bl = callPackage ../os-specific/linux/mba6x_bl { };
583
584 mwprocapture = callPackage ../os-specific/linux/mwprocapture { };
585
586 mxu11x0 = callPackage ../os-specific/linux/mxu11x0 { };
587
588 # compiles but has to be integrated into the kernel somehow
589 # Let's have it uncommented and finish it..
590 ndiswrapper = callPackage ../os-specific/linux/ndiswrapper { };
591
592 netatop = callPackage ../os-specific/linux/netatop { };
593
594 perf = callPackage ../os-specific/linux/kernel/perf { };
595
596 prl-tools = callPackage ../os-specific/linux/prl-tools { };
597
598 isgx = callPackage ../os-specific/linux/isgx { };
599
600 rr-zen_workaround = callPackage ../development/tools/analysis/rr/zen_workaround.nix { };
601
602 sheep-net = callPackage ../os-specific/linux/sheep-net { };
603
604 shufflecake = callPackage ../os-specific/linux/shufflecake { };
605
606 sysdig = callPackage ../os-specific/linux/sysdig { };
607
608 systemtap = callPackage ../development/tools/profiling/systemtap { };
609
610 system76 = callPackage ../os-specific/linux/system76 { };
611
612 system76-acpi = callPackage ../os-specific/linux/system76-acpi { };
613
614 system76-io = callPackage ../os-specific/linux/system76-io { };
615
616 tmon = callPackage ../os-specific/linux/tmon { };
617
618 tp_smapi = callPackage ../os-specific/linux/tp_smapi { };
619
620 tt-kmd = callPackage ../os-specific/linux/tt-kmd { };
621
622 turbostat = callPackage ../os-specific/linux/turbostat { };
623
624 corefreq = callPackage ../os-specific/linux/corefreq { };
625
626 trelay = callPackage ../os-specific/linux/trelay { };
627
628 universal-pidff = callPackage ../os-specific/linux/universal-pidff { };
629
630 usbip = callPackage ../os-specific/linux/usbip { };
631
632 v86d = callPackage ../os-specific/linux/v86d { };
633
634 veikk-linux-driver = callPackage ../os-specific/linux/veikk-linux-driver { };
635 vendor-reset = callPackage ../os-specific/linux/vendor-reset { };
636
637 vhba = callPackage ../applications/emulators/cdemu/vhba.nix { };
638
639 virtio_vmmci = callPackage ../os-specific/linux/virtio_vmmci { };
640
641 virtualbox = callPackage ../os-specific/linux/virtualbox {
642 virtualbox = pkgs.virtualboxHardened;
643 };
644
645 virtualboxGuestAdditions =
646 callPackage ../applications/virtualization/virtualbox/guest-additions
647 { };
648
649 mm-tools = callPackage ../os-specific/linux/mm-tools { };
650
651 vmm_clock = callPackage ../os-specific/linux/vmm_clock { };
652
653 vmware = callPackage ../os-specific/linux/vmware { };
654
655 wireguard =
656 if lib.versionOlder kernel.version "5.6" then
657 callPackage ../os-specific/linux/wireguard { }
658 else
659 null;
660
661 x86_energy_perf_policy = callPackage ../os-specific/linux/x86_energy_perf_policy { };
662
663 xone =
664 if lib.versionAtLeast kernel.version "5.4" then callPackage ../os-specific/linux/xone { } else null;
665
666 xpadneo = callPackage ../os-specific/linux/xpadneo { };
667
668 yt6801 = callPackage ../os-specific/linux/yt6801 { };
669
670 ithc = callPackage ../os-specific/linux/ithc { };
671
672 ryzen-smu = callPackage ../os-specific/linux/ryzen-smu { };
673
674 zenpower = callPackage ../os-specific/linux/zenpower { };
675
676 zfs_2_2 = callPackage ../os-specific/linux/zfs/2_2.nix {
677 configFile = "kernel";
678 inherit pkgs kernel;
679 };
680 zfs_2_3 = callPackage ../os-specific/linux/zfs/2_3.nix {
681 configFile = "kernel";
682 inherit pkgs kernel;
683 };
684 zfs_unstable = callPackage ../os-specific/linux/zfs/unstable.nix {
685 configFile = "kernel";
686 inherit pkgs kernel;
687 };
688
689 can-isotp = callPackage ../os-specific/linux/can-isotp { };
690
691 qc71_laptop = callPackage ../os-specific/linux/qc71_laptop { };
692
693 hid-ite8291r3 = callPackage ../os-specific/linux/hid-ite8291r3 { };
694
695 hid-t150 = callPackage ../os-specific/linux/hid-t150 { };
696
697 hid-tmff2 = callPackage ../os-specific/linux/hid-tmff2 { };
698
699 hpuefi-mod = callPackage ../os-specific/linux/hpuefi-mod { };
700
701 drbd = callPackage ../os-specific/linux/drbd/driver.nix { };
702
703 nullfs = callPackage ../os-specific/linux/nullfs { };
704
705 msi-ec = callPackage ../os-specific/linux/msi-ec { };
706
707 tsme-test = callPackage ../os-specific/linux/tsme-test { };
708
709 xpad-noone = callPackage ../os-specific/linux/xpad-noone { };
710
711 }
712 // lib.optionalAttrs config.allowAliases {
713 zfs = throw "linuxPackages.zfs has been removed, use zfs_* instead, or linuxPackages.\${pkgs.zfs.kernelModuleAttribute}"; # added 2025-01-23
714 zfs_2_1 = throw "zfs_2_1 has been removed"; # added 2024-12-25;
715 ati_drivers_x11 = throw "ati drivers are no longer supported by any kernel >=4.1"; # added 2021-05-18;
716 deepin-anything-module = throw "the Deepin desktop environment and associated tools have been removed from nixpkgs due to lack of maintenance";
717 hid-nintendo = throw "hid-nintendo was added in mainline kernel version 5.16"; # Added 2023-07-30
718 sch_cake = throw "sch_cake was added in mainline kernel version 4.19"; # Added 2023-06-14
719 rtl8723bs = throw "rtl8723bs was added in mainline kernel version 4.12"; # Added 2023-06-14
720 vm-tools = self.mm-tools;
721 xmm7360-pci = throw "Support for the XMM7360 WWAN card was added to the iosm kmod in mainline kernel version 5.18";
722 amdgpu-pro = throw "amdgpu-pro was removed due to lack of maintenance"; # Added 2024-06-16
723 kvdo = throw "kvdo was removed, because it was added to mainline in kernel version 6.9"; # Added 2024-07-08
724 system76-power = lib.warnOnInstantiate "kernelPackages.system76-power is now pkgs.system76-power" pkgs.system76-power; # Added 2024-10-16
725 system76-scheduler = lib.warnOnInstantiate "kernelPackages.system76-scheduler is now pkgs.system76-scheduler" pkgs.system76-scheduler; # Added 2024-10-16
726 tuxedo-keyboard = self.tuxedo-drivers; # Added 2024-09-28
727 phc-intel = throw "phc-intel drivers are no longer supported by any kernel >=4.17"; # added 2025-07-18
728 }
729 );
730
731 hardenedPackagesFor = kernel: overrides: packagesFor (hardenedKernelFor kernel overrides);
732
733 vanillaPackages = {
734 # recurse to build modules for the kernels
735 linux_5_4 = recurseIntoAttrs (packagesFor kernels.linux_5_4);
736 linux_5_10 = recurseIntoAttrs (packagesFor kernels.linux_5_10);
737 linux_5_15 = recurseIntoAttrs (packagesFor kernels.linux_5_15);
738 linux_6_1 = recurseIntoAttrs (packagesFor kernels.linux_6_1);
739 linux_6_6 = recurseIntoAttrs (packagesFor kernels.linux_6_6);
740 linux_6_12 = recurseIntoAttrs (packagesFor kernels.linux_6_12);
741 linux_6_15 = recurseIntoAttrs (packagesFor kernels.linux_6_15);
742 linux_6_16 = recurseIntoAttrs (packagesFor kernels.linux_6_16);
743 }
744 // lib.optionalAttrs config.allowAliases {
745 linux_4_19 = throw "linux 4.19 was removed because it will reach its end of life within 24.11"; # Added 2024-09-21
746 linux_6_9 = throw "linux 6.9 was removed because it reached its end of life upstream"; # Added 2024-08-02
747 linux_6_10 = throw "linux 6.10 was removed because it reached its end of life upstream"; # Added 2024-10-23
748 linux_6_11 = throw "linux 6.11 was removed because it reached its end of life upstream"; # Added 2025-03-23
749 linux_6_13 = throw "linux 6.13 was removed because it reached its end of life upstream"; # Added 2025-06-22
750 linux_6_14 = throw "linux 6.14 was removed because it reached its end of life upstream"; # Added 2025-06-22
751 };
752
753 rtPackages = {
754 # realtime kernel packages
755 linux_rt_5_4 = packagesFor kernels.linux_rt_5_4;
756 linux_rt_5_10 = packagesFor kernels.linux_rt_5_10;
757 linux_rt_5_15 = packagesFor kernels.linux_rt_5_15;
758 linux_rt_6_1 = packagesFor kernels.linux_rt_6_1;
759 linux_rt_6_6 = packagesFor kernels.linux_rt_6_6;
760 };
761
762 rpiPackages = {
763 linux_rpi1 = packagesFor kernels.linux_rpi1;
764 linux_rpi2 = packagesFor kernels.linux_rpi2;
765 linux_rpi3 = packagesFor kernels.linux_rpi3;
766 linux_rpi4 = packagesFor kernels.linux_rpi4;
767 };
768
769 packages = recurseIntoAttrs (
770 vanillaPackages
771 // rtPackages
772 // rpiPackages
773 // {
774
775 # Intentionally lacks recurseIntoAttrs, as -rc kernels will quite likely break out-of-tree modules and cause failed Hydra builds.
776 linux_testing = packagesFor kernels.linux_testing;
777
778 linux_hardened = recurseIntoAttrs (packagesFor kernels.linux_hardened);
779
780 linux_6_12_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_12_hardened);
781 linux_6_15_hardened = recurseIntoAttrs (packagesFor kernels.linux_6_15_hardened);
782
783 linux_zen = recurseIntoAttrs (packagesFor kernels.linux_zen);
784 linux_lqx = recurseIntoAttrs (packagesFor kernels.linux_lqx);
785 linux_xanmod = recurseIntoAttrs (packagesFor kernels.linux_xanmod);
786 linux_xanmod_stable = recurseIntoAttrs (packagesFor kernels.linux_xanmod_stable);
787 linux_xanmod_latest = recurseIntoAttrs (packagesFor kernels.linux_xanmod_latest);
788
789 linux_libre = recurseIntoAttrs (packagesFor kernels.linux_libre);
790
791 linux_latest_libre = recurseIntoAttrs (packagesFor kernels.linux_latest_libre);
792 __recurseIntoDerivationForReleaseJobs = true;
793 }
794 // lib.optionalAttrs config.allowAliases {
795
796 linux_5_10_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
797 linux_5_15_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
798 linux_6_1_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
799 linux_6_6_hardened = throw "linux_hardened on nixpkgs only contains latest stable and latest LTS";
800
801 linux_4_19_hardened = throw "linux 4.19 was removed because it will reach its end of life within 24.11";
802 linux_5_4_hardened = throw "linux_5_4_hardened was removed because it was broken";
803 linux_6_9_hardened = throw "linux 6.9 was removed because it has reached its end of life upstream";
804 linux_6_10_hardened = throw "linux 6.10 was removed because it has reached its end of life upstream";
805 linux_6_11_hardened = throw "linux 6.11 was removed because it has reached its end of life upstream";
806 linux_6_13_hardened = throw "linux 6.13 was removed because it has reached its end of life upstream";
807 linux_6_14_hardened = throw "linux 6.14 was removed because it has reached its end of life upstream";
808 linux_ham = throw "linux_ham has been removed in favour of the standard kernel packages";
809 }
810 );
811
812 packageAliases = {
813 linux_default = packages.linux_6_12;
814 # Update this when adding the newest kernel major version!
815 linux_latest = packages.linux_6_16;
816 linux_rt_default = packages.linux_rt_5_15;
817 linux_rt_latest = packages.linux_rt_6_6;
818 }
819 // lib.optionalAttrs config.allowAliases {
820 linux_mptcp = throw "'linux_mptcp' has been moved to https://github.com/teto/mptcp-flake";
821 };
822
823 manualConfig = callPackage ../os-specific/linux/kernel/manual-config.nix { };
824
825 customPackage =
826 {
827 version,
828 src,
829 modDirVersion ? lib.versions.pad 3 version,
830 configfile,
831 allowImportFromDerivation ? true,
832 }:
833 recurseIntoAttrs (
834 packagesFor (manualConfig {
835 inherit
836 version
837 src
838 modDirVersion
839 configfile
840 allowImportFromDerivation
841 ;
842 })
843 );
844
845 # Derive one of the default .config files
846 linuxConfig =
847 {
848 src,
849 kernelPatches ? [ ],
850 version ? (builtins.parseDrvName src.name).version,
851 makeTarget ? "defconfig",
852 name ? "kernel.config",
853 }:
854 stdenvNoCC.mkDerivation {
855 inherit name src;
856 depsBuildBuild = [
857 buildPackages.stdenv.cc
858 ]
859 ++ lib.optionals (lib.versionAtLeast version "4.16") [
860 buildPackages.bison
861 buildPackages.flex
862 ];
863 patches = map (p: p.patch) kernelPatches; # Patches may include new configs.
864 postPatch = ''
865 patchShebangs scripts/
866 '';
867 buildPhase = ''
868 set -x
869 make \
870 ARCH=${stdenv.hostPlatform.linuxArch} \
871 HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc \
872 ${makeTarget}
873 '';
874 installPhase = ''
875 cp .config $out
876 '';
877 };
878
879 buildLinux = callPackage ../os-specific/linux/kernel/generic.nix { };
880}