{ lib, stdenv, fetchFromGitHub, pkgs, }: stdenv.mkDerivation (finalAttrs: { pname = "kindletool"; version = "2.6.5-unstable-2025-07-14"; src = fetchFromGitHub { owner = "NiLuJe"; repo = "KindleTool"; rev = "828bf45bd6010c01fe91bb863bac97ef20cafb44"; hash = "sha256-WWb2N/CRXIiFYG6ZRmcfBowiaSLA7jr9x8Zr13MlY2U="; }; nativeBuildInputs = with pkgs; [ pkg-config ]; buildInputs = with pkgs; [ nettle libarchive zlib ]; dontConfigure = true; postPatch = '' substituteInPlace KindleTool/Makefile \ --replace 'DESTDIR?=/usr/local' "DESTDIR?=$out" substituteInPlace KindleTool/version.sh \ --replace 'COMPILE_BY="$(whoami | sed 's/\\/\\\\/')"' 'COMPILE_BY="???"' \ --replace 'COMPILE_HOST="$(hostname -s)"' 'COMPILE_HOST="???"' \ --replace 'COMPILE_HOST="$(hostname -s)"' 'COMPILE_HOST="???"' ''; # installPhase = '' # mkdir -p $out/bin # ls -la ./ # touch $out/bin/xx # ''; meta = with lib; { description = "A tool for creating & extracting Kindle updates and more"; mainProgram = "kindletool"; license = licenses.gpl3Only; platforms = platforms.linux; homepage = "https://github.com/NiLuJe/KindleTool"; }; })