at 18.09-beta 1.4 kB view raw
1{ stdenvNoCC, lib, buildPackages 2, fetchurl, perl 3}: 4 5assert stdenvNoCC.hostPlatform.isLinux; 6 7let 8 common = { version, sha256, patches ? null }: stdenvNoCC.mkDerivation { 9 name = "linux-headers-${version}"; 10 11 src = fetchurl { 12 url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz"; 13 inherit sha256; 14 }; 15 16 ARCH = stdenvNoCC.hostPlatform.platform.kernelArch; 17 18 # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc. 19 # We do this so we have a build->build, not build->host, C compiler. 20 depsBuildBuild = [ buildPackages.stdenv.cc ]; 21 nativeBuildInputs = [ perl ]; 22 23 extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"]; 24 25 # "patches" array defaults to 'null' to avoid changing hash 26 # and causing mass rebuild 27 inherit patches; 28 29 buildPhase = '' 30 make mrproper headers_check SHELL=bash 31 ''; 32 33 installPhase = '' 34 make INSTALL_HDR_PATH=$out headers_install 35 36 # Some builds (e.g. KVM) want a kernel.release. 37 mkdir -p $out/include/config 38 echo "${version}-default" > $out/include/config/kernel.release 39 ''; 40 41 meta = with lib; { 42 description = "Header files and scripts for Linux kernel"; 43 license = licenses.gpl2; 44 platforms = platforms.linux; 45 }; 46 }; 47in { 48 49 linuxHeaders = common { 50 version = "4.15"; 51 sha256 = "0sd7l9n9h7vf9c6gd6ciji28hawda60yj0llh17my06m0s4lf9js"; 52 }; 53}