1let
2 allKernels = builtins.fromJSON (builtins.readFile ./kernels-org.json);
3in
4
5{ branch, lib, fetchurl, fetchzip, buildLinux, ... } @ args:
6
7let
8 thisKernel = allKernels.${branch};
9 inherit (thisKernel) version;
10
11 src =
12 # testing kernels are a special case because they don't have tarballs on the CDN
13 if branch == "testing"
14 then fetchzip {
15 url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
16 inherit (thisKernel) hash;
17 }
18 else fetchurl {
19 url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz";
20 inherit (thisKernel) hash;
21 };
22
23 args' = (builtins.removeAttrs args ["branch"]) // {
24 inherit src version;
25
26 modDirVersion = lib.versions.pad 3 version;
27 extraMeta.branch = branch;
28 } // (args.argsOverride or {});
29in
30buildLinux args'