Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 59 lines 2.2 kB view raw
1{ stdenv, lib, fetchFromGitHub, kernel }: 2 3 4let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8168"; 5 6in stdenv.mkDerivation rec { 7 name = "r8168-${kernel.version}-${version}"; 8 # on update please verify that the source matches the realtek version 9 version = "8.048.03"; 10 11 # This is a mirror. The original website[1] doesn't allow non-interactive 12 # downloads, instead emailing you a download link. 13 # [1] https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software 14 # I've verified manually (`diff -r`) that the source code for version 8.046.00 15 # is the same as the one available on the realtek website. 16 src = fetchFromGitHub { 17 owner = "mtorromeo"; 18 repo = "r8168"; 19 rev = version; 20 sha256 = "1l8llpcnapcaafxp7wlyny2ywh7k6q5zygwwjl9h0l6p04cghss4"; 21 }; 22 23 hardeningDisable = [ "pic" ]; 24 25 nativeBuildInputs = kernel.moduleBuildDependencies; 26 27 # avoid using the Makefile directly -- it doesn't understand 28 # any kernel but the current. 29 # based on the ArchLinux pkgbuild: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/r8168 30 makeFlags = kernel.makeFlags ++ [ 31 "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" 32 "M=$(PWD)/src" 33 "modules" 34 ]; 35 preBuild = '' 36 makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8168_NAPI -DCONFIG_R8168_VLAN -DCONFIG_ASPM -DENABLE_S5WOL -DENABLE_EEE") 37 ''; 38 39 enableParallelBuilding = true; 40 41 installPhase = '' 42 mkdir -p ${modDestDir} 43 find . -name '*.ko' -exec cp --parents '{}' ${modDestDir} \; 44 find ${modDestDir} -name '*.ko' -exec xz -f '{}' \; 45 ''; 46 47 meta = with lib; { 48 description = "Realtek r8168 driver"; 49 longDescription = '' 50 A kernel module for Realtek 8168 network cards. 51 If you want to use this driver, you might need to blacklist the r8169 driver 52 by adding "r8169" to boot.blacklistedKernelModules. 53 ''; 54 license = licenses.gpl2Plus; 55 platforms = platforms.linux; 56 maintainers = with maintainers; [ timokau ]; 57 broken = (lib.versions.majorMinor kernel.modDirVersion) != "5.15"; 58 }; 59}