{ lib, stdenv, fetchFromGitHub, kernel, bc }: stdenv.mkDerivation rec { pname = "rtl88x2bu"; version = "${kernel.version}-unstable-2022-05-23"; src = fetchFromGitHub { owner = "morrownr"; repo = "88x2bu-20210702"; rev = "3fbe980a9a8cee223e4671449128212cf7514b3c"; sha256 = "1p4bp8g94ny385nl3m2ca824dbm6lhjvh7s5rqyzk220il2sa0nd"; }; hardeningDisable = [ "pic" ]; nativeBuildInputs = [ bc ] ++ kernel.moduleBuildDependencies; makeFlags = kernel.makeFlags; prePatch = '' substituteInPlace ./Makefile \ --replace /lib/modules/ "${kernel.dev}/lib/modules/" \ --replace '$(shell uname -r)' "${kernel.modDirVersion}" \ --replace /sbin/depmod \# \ --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/" ''; preInstall = '' mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/" ''; enableParallelBuilding = true; meta = with lib; { description = "Realtek rtl88x2bu driver"; homepage = "https://github.com/morrownr/88x2bu-20210702"; license = licenses.gpl2Only; platforms = platforms.linux; maintainers = [ maintainers.ralith ]; }; }