nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 fetchFromGitHub,
5}:
6
7stdenvNoCC.mkDerivation {
8 pname = "raspberrypi-wireless-firmware";
9 version = "0-unstable-2025-04-08";
10
11 srcs = [
12 (fetchFromGitHub {
13 name = "bluez-firmware";
14 owner = "RPi-Distro";
15 repo = "bluez-firmware";
16 rev = "2bbfb8438e824f5f61dae3f6ebb367a6129a4d63";
17 hash = "sha256-t+D4VUfEIov83KV4wiKp6TqXTHXGkxg/mANi4GW7QHs=";
18 })
19 (fetchFromGitHub {
20 name = "firmware-nonfree";
21 owner = "RPi-Distro";
22 repo = "firmware-nonfree";
23 rev = "c9d3ae6584ab79d19a4f94ccf701e888f9f87a53";
24 hash = "sha256-5ywIPs3lpmqVOVP3B75H577fYkkucDqB7htY2U1DW8U=";
25 })
26 ];
27
28 sourceRoot = ".";
29
30 dontBuild = true;
31 # Firmware blobs do not need fixing and should not be modified
32 dontFixup = true;
33
34 installPhase = ''
35 runHook preInstall
36 mkdir -p "$out/lib/firmware/brcm"
37
38 # Wifi firmware
39 cp -rv "$NIX_BUILD_TOP/firmware-nonfree/debian/config/brcm80211/." "$out/lib/firmware/"
40
41 # Bluetooth firmware
42 cp -rv "$NIX_BUILD_TOP/bluez-firmware/debian/firmware/broadcom/." "$out/lib/firmware/brcm"
43
44 # brcmfmac43455-sdio.bin is a symlink to the non-existent path: ../cypress/cyfmac43455-sdio.bin.
45 # See https://github.com/RPi-Distro/firmware-nonfree/issues/26
46 ln -s "./cyfmac43455-sdio-standard.bin" "$out/lib/firmware/cypress/cyfmac43455-sdio.bin"
47
48 pushd $out/lib/firmware/brcm &>/dev/null
49 # Symlinks for Zero 2W
50 ln -s "./brcmfmac43436-sdio.clm_blob" "$out/lib/firmware/brcm/brcmfmac43430b0-sdio.clm_blob"
51 popd &>/dev/null
52
53 runHook postInstall
54 '';
55
56 meta = with lib; {
57 description = "Firmware for builtin Wifi/Bluetooth devices in the Raspberry Pi 3+ and Zero W";
58 homepage = "https://github.com/RPi-Distro/firmware-nonfree";
59 license = licenses.unfreeRedistributableFirmware;
60 platforms = platforms.linux;
61 maintainers = with maintainers; [ lopsided98 ];
62 };
63}