biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / applications / misc / inkcut / default.nix
blobb711fd9330dc517fa38c16163da96420d75a8f74
1 { lib
2 , fetchpatch
3 , python3
4 , fetchFromGitHub
5 , wrapQtAppsHook
6 , cups
7 }:
9 python3.pkgs.buildPythonApplication rec {
10   pname = "inkcut";
11   version = "2.1.5";
13   src = fetchFromGitHub {
14     owner = pname;
15     repo = pname;
16     rev = "refs/tags/v${version}";
17     sha256 = "sha256-S5IrNWVoUp1w+P7DrKlOUOyY3Q16CHSct9ndZOB3UpU=";
18   };
20   patches = [
21     # fix opening the extension on inkscape 1.2
22     # https://github.com/inkcut/inkcut/pull/340
23     (fetchpatch {
24       url = "https://github.com/inkcut/inkcut/commit/d5d5d0ab3c588c576b668f4c7b07a10609ba2fd0.patch";
25       hash = "sha256-szfiOujuV7OOwYK/OU51m9FK6dzkbWds+h0cr5dGIg4=";
26     })
27     # fix loading a document from stdin (as used from the extension)
28     # https://github.com/inkcut/inkcut/issues/341
29     (fetchpatch {
30       url = "https://github.com/inkcut/inkcut/commit/748ab4157f87afec37dadd715094e87d02c9c739.patch";
31       hash = "sha256-ZGiwZru2bUYu749YSz5vxmGwLTAoYIAsafcX6PmdbYo=";
32       revert = true;
33     })
34     # fix distutils deprecation error
35     # https://github.com/inkcut/inkcut/pull/343
36     (fetchpatch {
37       url = "https://github.com/inkcut/inkcut/commit/9fb95204981bcc51401a1bc10caa02d1fae0d6cb.patch";
38       hash = "sha256-nriys7IWPGykZjVz+DIDsE9Tm40DewkHQlIUaxFwtzM=";
39     })
40   ];
42   postPatch = ''
43     substituteInPlace inkcut/device/transports/printer/plugin.py \
44       --replace ", 'lpr', " ", '${cups}/bin/lpr', "
45   '';
47   nativeBuildInputs = [ wrapQtAppsHook ];
49   propagatedBuildInputs = with python3.pkgs; [
50     enamlx
51     twisted
52     lxml
53     qreactor
54     jsonpickle
55     pyserial
56     pycups
57     qtconsole
58     pyqt5
59     setuptools
60   ];
62   # QtApplication.instance() does not work during tests?
63   doCheck = false;
65   pythonImportsCheck = [
66     "inkcut"
67     "inkcut.cli"
68     "inkcut.console"
69     "inkcut.core"
70     "inkcut.device"
71     "inkcut.job"
72     "inkcut.joystick"
73     "inkcut.monitor"
74     "inkcut.preview"
75   ];
77   dontWrapQtApps = true;
78   makeWrapperArgs = [ "--unset" "PYTHONPATH" "\${qtWrapperArgs[@]}" ];
80   postInstall = ''
81     mkdir -p $out/share/inkscape/extensions
83     cp plugins/inkscape/* $out/share/inkscape/extensions
85     sed -i "s|cmd = \['inkcut'\]|cmd = \['$out/bin/inkcut'\]|" $out/share/inkscape/extensions/inkcut_cut.py
86     sed -i "s|cmd = \['inkcut'\]|cmd = \['$out/bin/inkcut'\]|" $out/share/inkscape/extensions/inkcut_open.py
87   '';
89   meta = with lib; {
90     homepage = "https://www.codelv.com/projects/inkcut/";
91     description = "Control 2D plotters, cutters, engravers, and CNC machines";
92     mainProgram = "inkcut";
93     license = licenses.gpl3;
94     maintainers = with maintainers; [ raboof ];
95   };