nixpkgs-suyu/pkgs/os-specific/linux/rtl8812au/default.nix
Alyssa Ross db1f8c596d linuxPackages.rtl8812au: parallel build
So much faster.  Tested at -j48.
2021-08-30 11:35:52 +00:00

55 lines
1.8 KiB
Nix

{ 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.isi686 || stdenv.hostPlatform.isx86_64) 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.isHardened;
};
}