nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 ghostscript,
6 imagemagick,
7 poppler-utils,
8 python3,
9 tesseract5,
10}:
11
12python3.pkgs.buildPythonApplication rec {
13 pname = "invoice2data";
14 version = "0.4.4";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "invoice-x";
19 repo = "invoice2data";
20 rev = "v${version}";
21 hash = "sha256-pAvkp8xkHYi/7ymbxaT7/Jhu44j2P8emm8GyXC6IBnI=";
22 };
23
24 patches = [
25 # https://github.com/invoice-x/invoice2data/pull/522
26 (fetchpatch {
27 name = "clean-up-build-dependencies.patch";
28 url = "https://github.com/invoice-x/invoice2data/commit/ccea3857c7c8295ca51dc24de6cde78774ea7e64.patch";
29 hash = "sha256-BhqPW4hWG/EaR3qBv5a68dcvIMrCCT74GdDHr0Mss5Q=";
30 })
31 ];
32
33 build-system = with python3.pkgs; [
34 setuptools
35 setuptools-git
36 ];
37
38 dependencies = with python3.pkgs; [
39 dateparser
40 pdfminer-six
41 pillow
42 pyyaml
43 setuptools # pkg_resources is imported during runtime
44 ];
45
46 makeWrapperArgs = [
47 "--prefix"
48 "PATH"
49 ":"
50 (lib.makeBinPath [
51 ghostscript
52 imagemagick
53 tesseract5
54 poppler-utils
55 ])
56 ];
57
58 # Tests fails even when ran manually on my ubuntu machine !!
59 doCheck = false;
60
61 pythonImportsCheck = [
62 "invoice2data"
63 ];
64
65 meta = {
66 description = "Data extractor for PDF invoices";
67 mainProgram = "invoice2data";
68 homepage = "https://github.com/invoice-x/invoice2data";
69 license = lib.licenses.mit;
70 maintainers = with lib.maintainers; [ psyanticy ];
71 };
72}