nixpkgs/pkgs/os-specific/linux/rtl8821cu/default.nix

38 lines
1.1 KiB
Nix

{ lib, stdenv, fetchFromGitHub, kernel, bc }:
stdenv.mkDerivation rec {
pname = "rtl8821cu";
version = "${kernel.version}-unstable-2021-05-19";
src = fetchFromGitHub {
owner = "morrownr";
repo = "8821cu";
rev = "2430c354c9b15fa6193a263c99ce57211d50c66f";
sha256 = "sha256-PkrpwebZYh/hBukqDQf6pxfbkVyA+CpYtte5pmzgLtw=";
};
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 rtl8821cu driver";
homepage = "https://github.com/morrownr/8821cu";
license = licenses.gpl2Only;
platforms = platforms.linux;
maintainers = [ maintainers.contrun ];
};
}