{ lib, stdenv, fetchFromGitHub, kernel, bc }: stdenv.mkDerivation rec { pname = "rtl8821cu"; version = "${kernel.version}-unstable-2021-10-21"; src = fetchFromGitHub { owner = "morrownr"; repo = "8821cu"; rev = "4e2d84c5e70245f850877f355e8bf293f252f61c"; sha256 = "1j32psvfgzfs5b1pdff6xk76iz7j8scakji6zm3vgqb2ssbxx1k1"; }; hardeningDisable = [ "pic" ]; nativeBuildInputs = [ bc ]; buildInputs = kernel.moduleBuildDependencies; 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 rtl8821cu driver"; homepage = "https://github.com/morrownr/8821cu"; license = licenses.gpl2Only; platforms = platforms.linux; maintainers = [ maintainers.contrun ]; }; }