codesnap: init at 0.8.2 (#364266)
[NixPkgs.git] / pkgs / os-specific / linux / rtl8821au / default.nix
blobdacc0d1a357fac5f3b8c4149ed28b60dd739be8a
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   kernel,
6   bc,
7   nukeReferences,
8 }:
10 stdenv.mkDerivation {
11   pname = "rtl8821au";
12   version = "${kernel.version}-unstable-2024-03-16";
14   src = fetchFromGitHub {
15     owner = "morrownr";
16     repo = "8821au-20210708";
17     rev = "168ac48174067e17ffb9f8b15ab802f37447dacc";
18     hash = "sha256-eB9RCoU5jg5fgZkfcef9fsQ6tyD8gTPD+wYcR6PbWNw=";
19   };
21   nativeBuildInputs = [
22     bc
23     nukeReferences
24   ] ++ kernel.moduleBuildDependencies;
26   hardeningDisable = [
27     "pic"
28     "format"
29   ];
31   env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
33   makeFlags =
34     [
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     ];
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   '';
53   preInstall = ''
54     mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/net/wireless/"
55   '';
57   postInstall = ''
58     nuke-refs $out/lib/modules/*/kernel/net/wireless/*.ko
59   '';
61   enableParallelBuilding = true;
63   meta = with lib; {
64     description = "rtl8821AU and rtl8812AU chipset driver with firmware";
65     homepage = "https://github.com/morrownr/8821au";
66     license = licenses.gpl2Only;
67     platforms = lib.platforms.linux;
68     maintainers = with maintainers; [ plchldr ];
69   };