5d26766cbf
Added homepage where missing, where the sources are pulled from: - https://github.com - https://git.sr.ht - https://gitlab.com - https://invent.kde.org - https://codeberg.org - https://gitlab.gnome.org - https://gitlab.freedesktop.org - https://git.FreeBSD.org - https://salsa.debian.org - https://git.tvdr.de - https://git.suckless.org
69 lines
2.1 KiB
Nix
69 lines
2.1 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
fetchFromGitHub,
|
|
kernel,
|
|
kernelModuleMakeFlags,
|
|
}:
|
|
|
|
let
|
|
modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wireless/realtek/r8168";
|
|
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
name = "${pname}-${version}-${kernel.version}";
|
|
pname = "r8168";
|
|
# on update please verify that the source matches the realtek version
|
|
version = "8.056.02";
|
|
|
|
# This is a mirror. The original website[1] doesn't allow non-interactive
|
|
# downloads, instead emailing you a download link.
|
|
# [1] https://www.realtek.com/Download/List?cate_id=584
|
|
# I've verified manually (`diff -r`) that the source code for version 8.055.00
|
|
# is the same as the one available on the realtek website.
|
|
src = fetchFromGitHub {
|
|
owner = "mtorromeo";
|
|
repo = "r8168";
|
|
rev = version;
|
|
sha256 = "sha256-KKfI03RrD+34+KSxwTwDkeB4sGFNY/tU/YbfrfVkTp8=";
|
|
};
|
|
|
|
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
|
|
makeFlags = kernelModuleMakeFlags ++ [
|
|
"-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
|
"modules"
|
|
];
|
|
preBuild = ''
|
|
absSrc=$(realpath src)
|
|
makeFlagsArray+=("M=$absSrc")
|
|
makeFlagsArray+=("EXTRA_CFLAGS=-DCONFIG_R8168_NAPI -DCONFIG_R8168_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 '{}' \;
|
|
'';
|
|
|
|
meta = {
|
|
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.
|
|
'';
|
|
homepage = "https://github.com/mtorromeo/r8168";
|
|
license = lib.licenses.gpl2Plus;
|
|
platforms = lib.platforms.linux;
|
|
maintainers = [ ];
|
|
};
|
|
}
|