nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

commit 538c40956f702d04e91510915267159945668a70
parent 7264ccf5a65f7edf3be8edd0f71ccbbc6c06bbf6
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date:   Thu, 27 Jan 2022 11:24:35 +0300

Add capture2text

Diffstat:
Mpkgs/default.nix | 1+
Apkgs/misc/capture2text/default.nix | 47+++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/pkgs/default.nix b/pkgs/default.nix @@ -272,6 +272,7 @@ lib.makeScope newScope ( apibackuper = callPackage ./misc/apibackuper { }; ascii-dash = callPackage ./misc/ascii-dash { }; btpd = callPackage ./misc/btpd { }; + capture2text = libsForQt5.callPackage ./misc/capture2text { }; cfiles = callPackage ./misc/cfiles { }; csvquote = callPackage ./misc/csvquote { }; csvtools = callPackage ./misc/csvtools { }; diff --git a/pkgs/misc/capture2text/default.nix b/pkgs/misc/capture2text/default.nix @@ -0,0 +1,47 @@ +{ lib, stdenv, fetchurl, qmake, unzip, leptonica, tesseract4, wrapQtAppsHook }: + +stdenv.mkDerivation rec { + pname = "capture2text"; + version = "4.6.2"; + + src = fetchurl { + url = "mirror://sourceforge/capture2text/SourceCode/Capture2Text_v${version}/Capture2Text_v${version}_Source_Code.zip"; + sha256 = "sha256-FeQ5E2lW+QOcg6Qi1I75W4BkQmfDiZtJ7+U2K08Ji2U="; + }; + + postPatch = '' + substituteInPlace Capture2Text.pro \ + --replace "QMAKE_CXXFLAGS" "#QMAKE_CXXFLAGS" \ + --replace "-lpvt.cppan.demo.danbloomberg.leptonica-1.74.4" "-llept" \ + --replace "-luser32" "-ltesseract" + + substituteInPlace CommandLine.cpp \ + --replace "Capture2Text_CLI.exe" "capture2text" + + # See https://github.com/DanBloomberg/leptonica/commit/990a76de210636dfc4c976c7d3c6d63500e363b9 + substituteInPlace PreProcess.cpp \ + --replace "pixAverageInRect(binarizeForNegPixs, &negRect, &pixelAvg)" "pixAverageInRect(binarizeForNegPixs, NULL, &negRect, 0, 255, 1, &pixelAvg)" + ''; + + buildInputs = [ leptonica tesseract4 ]; + + nativeBuildInputs = [ qmake unzip wrapQtAppsHook ]; + + qmakeFlags = [ + "CONFIG+=console" + "INCLUDEPATH+=${leptonica}/include/leptonica" + "INCLUDEPATH+=${tesseract4}/include/tesseract" + ]; + + installPhase = '' + install -Dm755 Capture2Text_CLI $out/bin/capture2text + ''; + + meta = with lib; { + description = "Capture2Text enables users to quickly OCR a portion of the screen using a keyboard shortcut"; + homepage = "http://capture2text.sourceforge.net/"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.sikmir ]; + platforms = platforms.unix; + }; +}