1 { lib, stdenv, fetchFromGitHub, libtiff, fpc }:
3 stdenv.mkDerivation rec {
8 src = fetchFromGitHub {
12 hash = "sha256-xghVOEMkQ/mXpOzJqMaT3SII7xneMNoFqRlqjtzmDnA=";
15 nativeBuildInputs = [ fpc ];
16 buildInputs = [ libtiff ];
20 patchShebangs ./Scripts
22 # Deskew insists on using dlopen to load libtiff, we insist it links against it.
23 sed -i -e 's/{$DEFINE DYNAMIC_DLL_LOADING}//' Imaging/LibTiff/LibTiffDynLib.pas
24 sed -i -e 's/if LibTiffDynLib\.LoadTiffLibrary then//' Imaging/LibTiff/ImagingTiffLib.pas
25 # Make sure libtiff is in the RPATH, so that Nix can find and track the runtime dependency
26 export NIX_LDFLAGS="$NIX_LDFLAGS -rpath ${lib.getLib libtiff}/lib"
27 pushd Scripts && ./compile.sh && popd
33 install -Dt $out/bin Bin/deskew
38 description = "A command line tool for deskewing scanned text documents";
39 homepage = "https://galfar.vevb.net/deskew";
40 license = with licenses; [ mit mpl11 ];
41 maintainers = with maintainers; [ryantm];
42 platforms = platforms.all;
43 mainProgram = "deskew";