~aasg/nixexprs

ref: 61437e1c44b463cbb9b034fc1b2ce5d76f287ef1 nixexprs/pkgs/os-specific/linux/rtl8723bu/default.nix -rw-r--r-- 1.5 KiB
61437e1c — Aluísio Augusto Silva Gonçalves Replace stdenv.lib with lib 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ stdenv, lib, fetchFromGitHub, kernel, concurrentMode ? false }:

stdenv.mkDerivation rec {
  pname = "rtl8723bu-unstable";
  version = "2020-11-24";

  src = fetchFromGitHub {
    owner = "lwfinger";
    repo = "rtl8723bu";
    rev = "9ce1c38439f4f574bb7adaf33949835c25536a28";
    hash = "sha256-NSLGB0dgDu5TIpS0GszBFjzC+8uIKncs+jeJowtBjLQ=";
  };

  postPatch = lib.optionalString (!concurrentMode) ''
    sed -i '/-DCONFIG_CONCURRENT_MODE/d' Makefile
  '';

  hardeningDisable = [
    "fortify"
    "pic"
    "stackprotector"
  ];

  nativeBuildInputs = kernel.moduleBuildDependencies;

  makeFlags = [
    # TODO: remove fallback post NixOS 20.09 (see also github:NixOS/nixpkgs#107214)
    "ARCH=${stdenv.hostPlatform.linuxArch or stdenv.hostPlatform.platform.kernelArch}"
    "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
    "KVER=${kernel.version}"
    "DEPMOD=true"
    "INSTALL_MOD_PATH=$(out)"
    # Fix build for Linux 5.8(+?) on Nixpkgs 20.09.
    # https://wiki.gentoo.org/wiki/Binutils_2.32_upgrade_notes/elfutils_0.175:_unable_to_initialize_decompress_status_for_section_.debug_info
    "USER_EXTRA_CFLAGS=-gz=none"
  ];

  enableParallelBuilding = true;

  meta = with lib; {
    description = "Driver for RTL8723BU";
    longDescription = ''
      Kernel driver for Realtek RTL8723BU Wireless Adapter with hardware ID 0bda:b720.
    '';
    homepage = "https://github.com/lwfinger/rtl8723bu";
    license = licenses.unfreeRedistributableFirmware;
    platforms = platforms.linux;
    maintainers = with maintainers; [ AluisioASG ];
  };
}