{ stdenv, fetchFromGitHub, kernel, bc }: stdenv.mkDerivation rec { name = "rtl8821ce-${kernel.version}-${version}"; version = "5.2.5_1.26055.20180108"; src = fetchFromGitHub { owner = "tomaspinho"; repo = "rtl8821ce"; rev = "ab6154e150bbc7d12b0525d4cc1298ae196e45de"; sha256 = "1my0hidqnv4s7hi5897m81pq0sjw05np0g27hlkg9fwb83b5kzsg"; }; 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 stdenv.lib; { description = "Realtek rtl8821ce driver"; homepage = "https://github.com/tomaspinho/rtl8821ce"; license = licenses.gpl2; platform = platforms.linux; maintainers = [ maintainers.hhm ]; }; }