summary refs log tree commit diff
path: root/pkgs/applications/science/electronics/flatcam/default.nix
blob: 2235cf0b4a3377daeb2d1236bafb90b60cfbc909 (plain) (blame)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{ lib
, fetchFromBitbucket
, buildPythonApplication
, pyqt5
, matplotlib
, numpy
, cycler
, python-dateutil
, kiwisolver
, six
, setuptools
, dill
, rtree
, pyopengl
, vispy
, ortools
, svg-path
, simplejson
, shapely
, freetype-py
, fonttools
, rasterio
, lxml
, ezdxf
, qrcode
, reportlab
, svglib
, gdal
, pyserial
, python3
}:

buildPythonApplication rec {
  pname = "flatcam";
  version = "unstable-2022-02-02";

  src = fetchFromBitbucket {
    owner = "jpcgt";
    repo = pname;
    rev = "ebf5cb9e3094362c4b0774a54cf119559c02211d"; # beta branch as of 2022-02-02
    hash = "sha256-QKkBPEM+HVYmSZ83b4JRmOmCMp7C3EUqbJKPqUXMiKE=";
  };

  format = "other";

  dontBuild = true;

  propagatedBuildInputs = [
    pyqt5
    matplotlib
    numpy
    cycler
    python-dateutil
    kiwisolver
    six
    setuptools
    dill
    rtree
    pyopengl
    vispy
    ortools
    svg-path
    simplejson
    shapely
    freetype-py
    fonttools
    rasterio
    lxml
    ezdxf
    qrcode
    reportlab
    svglib
    gdal
    pyserial
  ];

  preInstall = ''
    patchShebangs .

    sed -i "s|/usr/local/bin|$out/bin|" Makefile

    mkdir -p $out/share/{flatcam,applications}
    mkdir -p $out/bin
  '';

  installFlags = [
    "USER_ID=0"
    "LOCAL_PATH=/build/source/."
    "INSTALL_PATH=${placeholder "out"}/share/flatcam"
    "APPS_PATH=${placeholder "out"}/share/applications"
  ];

  postInstall = ''
    sed -i "s|python3|${python3.withPackages (_: propagatedBuildInputs)}/bin/python3|" $out/bin/flatcam-beta
    mv $out/bin/flatcam{-beta,}
  '';

  meta = with lib; {
    description = "2-D post processing for PCB fabrication on CNC routers";
    homepage = "https://bitbucket.org/jpcgt/flatcam";
    license = licenses.mit;
    maintainers = with maintainers; [ trepetti ];
  };
}