mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 14:00:04 +00:00
126 lines
2.4 KiB
Nix
126 lines
2.4 KiB
Nix
{
|
|
lib,
|
|
python3,
|
|
fetchFromGitHub,
|
|
wrapGAppsHook3,
|
|
|
|
# libs
|
|
gobject-introspection,
|
|
goocanvas_2,
|
|
unpaper,
|
|
djvulibre,
|
|
libtiff,
|
|
qpdf,
|
|
|
|
# tests
|
|
writableTmpDirAsHomeHook,
|
|
xvfb,
|
|
imagemagickBig,
|
|
poppler-utils,
|
|
ghostscript,
|
|
tesseract,
|
|
}:
|
|
|
|
let
|
|
runtimeExecDeps = [
|
|
unpaper
|
|
tesseract
|
|
djvulibre
|
|
libtiff
|
|
qpdf
|
|
];
|
|
|
|
in
|
|
python3.pkgs.buildPythonApplication (finalAttrs: {
|
|
pname = "scantpaper";
|
|
version = "3.0.11";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "carygravel";
|
|
repo = "scantpaper";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-6zjIEwDHdOIAIucV4T/zY10F80nQNOgnRkA+i2n7Sng=";
|
|
};
|
|
|
|
__structuredAttrs = true;
|
|
|
|
dontWrapGApps = true;
|
|
preFixup = ''
|
|
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
|
|
'';
|
|
|
|
postPatch = ''
|
|
# disable formatting check, which breaks on Black version change
|
|
substituteInPlace pyproject.toml \
|
|
--replace "--black" ""
|
|
'';
|
|
|
|
build-system = with python3.pkgs; [
|
|
setuptools
|
|
];
|
|
|
|
dependencies =
|
|
(with python3.pkgs; [
|
|
img2pdf
|
|
ocrmypdf
|
|
pycairo
|
|
pygobject3
|
|
sane
|
|
tesserocr
|
|
python-iso639
|
|
])
|
|
++ [
|
|
goocanvas_2
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
wrapGAppsHook3
|
|
gobject-introspection
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
nativeCheckInputs =
|
|
(with python3.pkgs; [
|
|
pytestCheckHook
|
|
pytest-cov # segfault with pytest-cov-stub
|
|
pytest-mock
|
|
pytest-xvfb
|
|
pytest-timeout
|
|
])
|
|
++ [
|
|
xvfb
|
|
imagemagickBig # "big" version needed for text rendering in tests
|
|
poppler-utils
|
|
ghostscript
|
|
]
|
|
++ runtimeExecDeps;
|
|
|
|
makeWrapperArgs = [
|
|
"--prefix"
|
|
"PATH"
|
|
":"
|
|
(lib.makeBinPath runtimeExecDeps)
|
|
];
|
|
|
|
postInstall = ''
|
|
install -Dm644 \
|
|
icons/hicolor/scalable/apps/scantpaper.svg \
|
|
$out/share/icons/hicolor/scalable/apps/scantpaper.svg
|
|
|
|
install -Dm444 \
|
|
org.scantpaper.desktop \
|
|
$out/share/applications/org.scantpaper.desktop
|
|
'';
|
|
|
|
meta = {
|
|
changelog = "https://github.com/carygravel/scantpaper/blob/${finalAttrs.src.tag}/changelog.md";
|
|
description = "GUI to produce PDFs or DjVus from scanned documents";
|
|
homepage = "https://github.com/carygravel/scantpaper";
|
|
license = lib.licenses.gpl3Only;
|
|
maintainers = with lib.maintainers; [ euxane ];
|
|
platforms = lib.platforms.linux;
|
|
mainProgram = "scantpaper";
|
|
};
|
|
})
|