43 lines
1.3 KiB
Nix
43 lines
1.3 KiB
Nix
{ stdenv, lib, kernel }:
|
|
|
|
|
|
let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8169";
|
|
|
|
in stdenv.mkDerivation rec {
|
|
name = "r8169-${kernel.version}-${version}";
|
|
version = "6.030.01";
|
|
|
|
src = ./r8169-${version}.tar.bz2;
|
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
|
|
|
# rename to avoid conflict with totally broken piece of crap from mainline kernel
|
|
patchPhase =
|
|
''
|
|
substituteInPlace src/Makefile --replace r8169.o r8169-vendor.o
|
|
substituteInPlace src/Makefile --replace r8169-objs r8169-vendor-objs
|
|
'';
|
|
|
|
# avoid using the Makefile directly -- it doesn't understand
|
|
# any kernel but the current.
|
|
# based on the ArchLinux pkgbuild: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/r8168
|
|
makeFlags = kernel.makeFlags ++ [
|
|
"-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
|
"M=$(PWD)/src"
|
|
"modules"
|
|
];
|
|
preBuild = ''
|
|
makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8169_NAPI -DCONFIG_R8169_VLAN -DCONFIG_ASPM -DENABLE_S5WOL -DENABLE_EEE")
|
|
'';
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
installPhase = ''
|
|
mkdir -p ${modDestDir}
|
|
find . -name '*.ko' -exec cp --parents '{}' ${modDestDir} \;
|
|
find ${modDestDir} -name '*.ko' -exec xz -f '{}' \;
|
|
'';
|
|
}
|