pkgs/SPFlashTool5: init

This commit is contained in:
Wroclaw 2025-02-01 20:01:17 +01:00
parent bf4bdc5e41
commit 6659d98a61

View file

@ -0,0 +1,84 @@
{
lib,
autoPatchelfHook,
fetchurl,
fontconfig,
freetype,
glib,
libgcc,
libjpeg,
libpng12,
libz,
makeWrapper,
stdenvNoCC,
unrar,
xorg,
}:
let
rarPassword = "spflashtool.com";
in
stdenvNoCC.mkDerivation (self: {
pname = "SPFlashTool5";
version = "5.1916";
src = fetchurl {
url = "https://spflashtool.com/files/SP_Flash_Tool-5.1916_Linux.rar";
hash = "sha256-5lv/uPfUoke0IwjGuV/gTBt4kCbr95mwco3q9cjW/mE=";
curlOptsList = [
"--referer" "https://spflashtool.com/download/"
];
};
nativeBuildInputs = [
autoPatchelfHook
fontconfig
freetype
glib
libgcc
libjpeg
libpng12
libz
makeWrapper
unrar
xorg.libSM
xorg.libX11
xorg.libXext
xorg.libXrender
];
unpackPhase = ''
runHook preUnpack
unrar x -p${lib.escapeShellArg rarPassword} $src
cd */
runHook postUnpack
'';
# 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://spflashtool.com/";
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ amozeo ];
};
})