depot/third_party/nixpkgs/pkgs/os-specific/linux/rtl8812au/default.nix

56 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchFromGitHub, kernel, bc, nukeReferences }:
stdenv.mkDerivation rec {
pname = "rtl8812au";
version = "${kernel.version}-5.9.3.2.20210427";
src = fetchFromGitHub {
owner = "gordboy";
repo = "rtl8812au-5.9.3.2";
rev = "6ef5d8fcdb0b94b7490a9a38353877708fca2cd4";
sha256 = "sha256-czExf4z0nf7XEJ1YnRSB3CrGV6NTmUKDiZjLmrh6Hwo=";
};
nativeBuildInputs = [ bc nukeReferences ];
buildInputs = kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" "format" ];
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/"
'';
makeFlags = [
"ARCH=${stdenv.hostPlatform.linuxArch}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n"))
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];
preInstall = ''
mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
'';
postInstall = ''
nuke-refs $out/lib/modules/*/kernel/net/wireless/*.ko
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Driver for Realtek 802.11ac, rtl8812au, provides the 8812au mod";
homepage = "https://github.com/gordboy/rtl8812au-5.9.3.2";
license = licenses.gpl2Only;
platforms = platforms.linux;
maintainers = with maintainers; [ fortuneteller2k ];
broken = kernel.kernelOlder "4.10" || kernel.kernelAtLeast "5.15" || kernel.isHardened;
};
}