depot/third_party/nixpkgs/pkgs/os-specific/linux/rtl8812au/default.nix
Default email 4bac34ead1 Project import generated by Copybara.
GitOrigin-RevId: 724bfc0892363087709bd3a5a1666296759154b1
2023-02-09 12:40:11 +01:00

52 lines
1.7 KiB
Nix

{ lib, stdenv, fetchFromGitHub, kernel, bc, nukeReferences }:
stdenv.mkDerivation rec {
pname = "rtl8812au";
version = "${kernel.version}-unstable-2023-01-17";
src = fetchFromGitHub {
owner = "morrownr";
repo = "8812au-20210629";
rev = "0a8bb3cec3ef91e6ef8cf549ca926016ba0a8acd";
sha256 = "sha256-25NaMQq9H6mqVynNQJXpqISAslxfEVSt3ELzG7s4mV4=";
};
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.isAarch then "y" else "n"))
] ++ lib.optionals (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/morrownr/8812au-20210629";
license = licenses.gpl2Only;
platforms = platforms.linux;
maintainers = with maintainers; [ fortuneteller2k ];
};
}