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