{ lib, autoPatchelfHook, fetchurl, fontconfig, freetype, glib, libgcc, libjpeg, libpng12, libz, makeWrapper, stdenvNoCC, unzip, xorg, }: stdenvNoCC.mkDerivation (self: { pname = "SPFlashTool5"; version = "5.2228"; src = fetchurl { url = "https://spflashtools.com/wp-content/uploads/SP_Flash_Tool_v5.2228_Linux.zip"; hash = "sha256-GLEe7TQf1X/rf7xYp7jrk0KbrMfSWpk4eK+KC26Y3xA="; }; nativeBuildInputs = [ autoPatchelfHook makeWrapper unzip ]; buildInputs = [ fontconfig freetype glib libgcc libjpeg libpng12 libz xorg.libSM xorg.libX11 xorg.libXext xorg.libXrender ]; # remove plugins that have outdated dependencies not available in nixpkgs # they are not needed to run the tool anyway prePatch = '' rm \ plugins/imageformats/libqsvg.so \ plugins/imageformats/libqmng.so \ plugins/imageformats/libqtiff.so ''; dontConfigure = true; dontBuild = true; dontCheck = true; installPhase = '' runHook preInstall mkdir -p $out/bin mkdir -p $out/share/SPFlashTool5 cp -r * $out/share/SPFlashTool5 chmod +x $out/share/SPFlashTool5/flash_tool makeWrapper $out/share/SPFlashTool5/flash_tool $out/bin/SPFlashTool5 runHook postInstall ''; meta = { description = "Flash tool for MediaTek devices"; homepage = "https://spflashtools.com/"; license = lib.licenses.unfree; maintainers = with lib.maintainers; [ amozeo ]; }; })