{ lib, stdenv, fetchFromGitHub, kernel, bc }: stdenv.mkDerivation rec { pname = "rtl8821ce-${kernel.version}"; version = "unstable-2021-03-21"; src = fetchFromGitHub { owner = "tomaspinho"; repo = "rtl8821ce"; rev = "897e7c4c15dd5a0a569745dc223d969a26ff5bfc"; sha256 = "0935dzz0njxh78wfd17yqah1dxn6b3kaszvzclwwrwwhwcrdp80j"; }; 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/" ''; meta = with lib; { description = "Realtek rtl8821ce driver"; homepage = "https://github.com/tomaspinho/rtl8821ce"; license = licenses.gpl2Only; platforms = platforms.linux; maintainers = with maintainers; [ hhm samuelgrf ]; }; }