Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 41 lines 897 B view raw
1let 2 allKernels = builtins.fromJSON (builtins.readFile ./kernels-org.json); 3in 4 5{ 6 branch, 7 lib, 8 fetchurl, 9 fetchzip, 10 buildLinux, 11 ... 12}@args: 13 14let 15 thisKernel = allKernels.${branch}; 16 inherit (thisKernel) version; 17 18 src = 19 # testing kernels are a special case because they don't have tarballs on the CDN 20 if branch == "testing" then 21 fetchzip { 22 url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz"; 23 inherit (thisKernel) hash; 24 } 25 else 26 fetchurl { 27 url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz"; 28 inherit (thisKernel) hash; 29 }; 30 31 args' = 32 (builtins.removeAttrs args [ "branch" ]) 33 // { 34 inherit src version; 35 36 modDirVersion = lib.versions.pad 3 version; 37 extraMeta.branch = branch; 38 } 39 // (args.argsOverride or { }); 40in 41buildLinux args'