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