summary refs log tree commit diff
path: root/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
blob: 0918279cc9a9c49411f89f76eefb291ae7654d17 (plain) (blame)
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
{ stdenv, fetchurl }:

stdenv.mkDerivation rec {
  name = "raspberrypi-wireless-firmware-${version}";
  version = "2018-05-30";

  srcs = [
    (fetchurl {
      url = "https://archive.raspberrypi.org/debian/pool/main/b/bluez-firmware/bluez-firmware_1.2-3+rpt5.debian.tar.xz";
      sha256 = "06zpyrz6frkgjy26hr3998klnhjdqxwashgjgvj9rgbcqy70nkxg";
    })
    (fetchurl {
      url = "https://archive.raspberrypi.org/debian/pool/main/f/firmware-nonfree/firmware-brcm80211_20161130-3+rpt3_all.deb";
      sha256 = "10l74ac28baprnsiylf2vy4pkxgb3crixid90ngs6si9smm7rn6z";
    })
  ];

  sourceRoot = ".";
  dontBuild = true;
  # Firmware blobs do not need fixing and should not be modified
  dontFixup = true;

  # Unpack the debian package
  unpackCmd = ''
    if ! [[ "$curSrc" =~ \.deb$ ]]; then return 1; fi
    ar -xf "$curSrc"
    tar -xf data.tar.xz
  '';

  installPhase = ''
    mkdir -p "$out/lib/firmware/brcm"

    # Wifi firmware
    for filename in lib/firmware/brcm/brcmfmac434??-sdio.*; do
      cp "$filename" "$out/lib/firmware/brcm"
    done

    # Bluetooth firmware
    cp broadcom/*.hcd "$out/lib/firmware/brcm"
  '';

  meta = with stdenv.lib; {
    description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3 and Zero W";
    homepage = https://archive.raspberrypi.org/debian/pool/main/f/firmware-nonfree/;
    license = licenses.unfreeRedistributableFirmware;
    platforms = platforms.linux;
    maintainers = with maintainers; [ lopsided98 ];
  };
}