{ stdenv, fetchzip }:

stdenv.mkDerivation rec {
  pname = "uefi_rpi4";
  version = "1.38";

  src = fetchzip {
    url = "https://github.com/pftf/RPi4/releases/download/v1.38/RPi4_UEFI_Firmware_v1.38.zip";
    hash = "sha256-9tOr80jcmguFy2bSz+H3TfmG8BkKyBTFoUZkMy8x+0g=";
    stripRoot = false;
  };

  installPhase = ''
    mkdir -p $out/share/uefi_rpi4
    cp -r * $out/share/uefi_rpi4
  '';

  meta = {
    description = "UEFI Firmware for Raspberry Pi 4";
    homepage = "https://github.com/pftf/RPi4";
    platforms = [ "aarch64-linux" ];
  };
}
