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