Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 86 lines 2.3 kB view raw
1{ 2 stdenvNoCC, 3 lib, 4 fetchFromGitHub, 5 makeWrapper, 6 python3, 7 binutils-unwrapped, 8 findutils, 9 flashrom, 10 gawk, 11 kmod, 12 pciutils, 13 libraspberrypi, 14}: 15stdenvNoCC.mkDerivation (finalAttrs: { 16 pname = "raspberrypi-eeprom"; 17 version = "2025.05.08-2712"; 18 19 src = fetchFromGitHub { 20 owner = "raspberrypi"; 21 repo = "rpi-eeprom"; 22 tag = "v${finalAttrs.version}"; 23 hash = "sha256-y3tBYKFyFz7ft82+zWGT6HUXR3hrq3mYMqJeUSsAKtQ="; 24 }; 25 26 buildInputs = [ python3 ]; 27 nativeBuildInputs = [ makeWrapper ]; 28 29 postPatch = '' 30 # Don't try to verify md5 signatures from /var/lib/dpkg and 31 # fix path to the configuration. 32 substituteInPlace rpi-eeprom-update \ 33 --replace 'IGNORE_DPKG_CHECKSUMS=''${LOCAL_MODE}' 'IGNORE_DPKG_CHECKSUMS=1' \ 34 --replace '/etc/default' '/etc' 35 ''; 36 37 installPhase = '' 38 mkdir -p "$out/bin" 39 cp rpi-eeprom-config rpi-eeprom-update rpi-eeprom-digest "$out/bin" 40 41 mkdir -p "$out/lib/firmware/raspberrypi" 42 for dirname in firmware-*; do 43 dirname_suffix="''${dirname/#firmware-}" 44 cp -rP "$dirname" "$out/lib/firmware/raspberrypi/bootloader-$dirname_suffix" 45 done 46 ''; 47 48 fixupPhase = '' 49 patchShebangs $out/bin 50 for i in rpi-eeprom-update rpi-eeprom-config; do 51 wrapProgram $out/bin/$i \ 52 --set FIRMWARE_ROOT "$out/lib/firmware/raspberrypi/bootloader" \ 53 ${lib.optionalString stdenvNoCC.hostPlatform.isAarch64 "--set VCMAILBOX ${libraspberrypi}/bin/vcmailbox"} \ 54 --prefix PATH : "${ 55 lib.makeBinPath ( 56 [ 57 binutils-unwrapped 58 findutils 59 flashrom 60 gawk 61 kmod 62 pciutils 63 (placeholder "out") 64 ] 65 ++ lib.optionals stdenvNoCC.hostPlatform.isAarch64 [ 66 libraspberrypi 67 ] 68 ) 69 }" 70 done 71 ''; 72 73 meta = with lib; { 74 description = "Installation scripts and binaries for the closed sourced Raspberry Pi 4 and 5 bootloader EEPROMs"; 75 homepage = "https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-4-boot-eeprom"; 76 license = with licenses; [ 77 bsd3 78 unfreeRedistributableFirmware 79 ]; 80 maintainers = with maintainers; [ 81 das_j 82 Luflosi 83 ]; 84 platforms = platforms.linux; 85 }; 86})