2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, kernel }:
|
|
|
|
|
|
|
|
|
|
|
|
let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8168";
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "r8168-${kernel.version}-${version}";
|
|
|
|
# on update please verify that the source matches the realtek version
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "8.052.01";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# This is a mirror. The original website[1] doesn't allow non-interactive
|
|
|
|
# downloads, instead emailing you a download link.
|
2022-03-30 09:31:56 +00:00
|
|
|
# [1] https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software
|
2024-02-29 20:09:43 +00:00
|
|
|
# I've verified manually (`diff -r`) that the source code for version 8.052.01
|
2020-04-24 23:36:52 +00:00
|
|
|
# is the same as the one available on the realtek website.
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mtorromeo";
|
|
|
|
repo = "r8168";
|
|
|
|
rev = version;
|
2024-02-29 20:09:43 +00:00
|
|
|
sha256 = "01mi7hh92nc7jaxkfrpz7j0ci78djrhgmq0im4k1270mwmvr0yzj";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
hardeningDisable = [ "pic" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
|
|
|
|
|
|
|
# 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
|
2022-03-30 09:31:56 +00:00
|
|
|
makeFlags = kernel.makeFlags ++ [
|
|
|
|
"-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
|
|
|
"M=$(PWD)/src"
|
|
|
|
"modules"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
preBuild = ''
|
2020-11-06 00:33:48 +00:00
|
|
|
makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8168_NAPI -DCONFIG_R8168_VLAN -DCONFIG_ASPM -DENABLE_S5WOL -DENABLE_EEE")
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p ${modDestDir}
|
|
|
|
find . -name '*.ko' -exec cp --parents '{}' ${modDestDir} \;
|
|
|
|
find ${modDestDir} -name '*.ko' -exec xz -f '{}' \;
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Realtek r8168 driver";
|
|
|
|
longDescription = ''
|
|
|
|
A kernel module for Realtek 8168 network cards.
|
|
|
|
If you want to use this driver, you might need to blacklist the r8169 driver
|
|
|
|
by adding "r8169" to boot.blacklistedKernelModules.
|
|
|
|
'';
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ timokau ];
|
2022-09-09 14:08:57 +00:00
|
|
|
broken = (lib.versions.majorMinor kernel.modDirVersion) != "5.15";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|