summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pr/printrun/package.nix
blob: 938bb8af062a6d7613d947a6284cad1bfe81cf0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
  lib,
  stdenv,
  python3Packages,
  fetchFromGitHub,
  glib,
  wrapGAppsHook3,
}:

python3Packages.buildPythonApplication (finalAttrs: {
  pname = "printrun";
  version = "2.2.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "kliment";
    repo = "Printrun";
    tag = "printrun-${finalAttrs.version}";
    hash = "sha256-INJNGAmghoPIiivQp6AV1XmhyIu8SjfKqL8PTpi/tkY=";
  };

  nativeBuildInputs = [
    glib
    wrapGAppsHook3
  ];

  build-system = with python3Packages; [
    setuptools
    cython
  ];

  dependencies =
    with python3Packages;
    [
      pyserial
      wxpython
      numpy
      pyglet
      psutil
      lxml
      platformdirs
      puremagic
    ]
    ++ lib.optional stdenv.hostPlatform.isLinux dbus-python
    ++ lib.optional stdenv.hostPlatform.isDarwin pyobjc-framework-Cocoa;

  pythonRelaxDeps = [ "pyglet" ];

  # pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"
  doCheck = false;

  postInstall = ''
    substituteInPlace $out/share/applications/*.desktop \
      --replace-fail /usr/bin/ ""
    substituteInPlace $out/share/applications/pronterface.desktop \
      --replace-fail "Path=/usr/share/pronterface/" ""
  '';

  dontWrapGApps = true;

  preFixup = ''
    makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
  '';

  meta = {
    description = "Pronterface, Pronsole, and Printcore - Pure Python 3d printing host software";
    homepage = "https://github.com/kliment/Printrun";
    license = lib.licenses.gpl3Plus;
    changelog = "https://github.com/kliment/Printrun/releases/tag/${finalAttrs.src.tag}";
  };
})