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