Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 70 lines 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 kernel, 6 bc, 7 nukeReferences, 8}: 9 10stdenv.mkDerivation { 11 pname = "rtl8821au"; 12 version = "${kernel.version}-unstable-2025-04-08"; 13 14 src = fetchFromGitHub { 15 owner = "morrownr"; 16 repo = "8821au-20210708"; 17 rev = "b90b76d30709fb82705cbc2e295a7dde9372a0a8"; 18 hash = "sha256-rS7UXey2x00Dn9E2l5nRiVElYNKMRjIYDa+qDCGt5ac="; 19 }; 20 21 nativeBuildInputs = [ 22 bc 23 nukeReferences 24 ] 25 ++ kernel.moduleBuildDependencies; 26 27 hardeningDisable = [ 28 "pic" 29 "format" 30 ]; 31 32 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; 33 34 makeFlags = [ 35 "ARCH=${stdenv.hostPlatform.linuxArch}" 36 ("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n")) 37 ( 38 "CONFIG_PLATFORM_ARM_RPI=" 39 + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n") 40 ) 41 ] 42 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 43 "CROSS_COMPILE=${stdenv.cc.targetPrefix}" 44 ]; 45 46 prePatch = '' 47 substituteInPlace ./Makefile \ 48 --replace /lib/modules/ "${kernel.dev}/lib/modules/" \ 49 --replace /sbin/depmod \# \ 50 --replace '$(MODDESTDIR)' "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/" 51 ''; 52 53 preInstall = '' 54 mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/" 55 ''; 56 57 postInstall = '' 58 nuke-refs $out/lib/modules/*/kernel/net/wireless/*.ko 59 ''; 60 61 enableParallelBuilding = true; 62 63 meta = with lib; { 64 description = "rtl8821AU and rtl8812AU chipset driver with firmware"; 65 homepage = "https://github.com/morrownr/8821au-20210708"; 66 license = licenses.gpl2Only; 67 platforms = lib.platforms.linux; 68 maintainers = with maintainers; [ plchldr ]; 69 }; 70}