about summary refs log tree commit diff
path: root/pkgs/development/python-modules/cadquery/default.nix
blob: 5db0b6ae2c99751fd4bf2ac50e0c1ab62e2b2c0f (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
{ lib
, buildPythonPackage
, toPythonModule
, pythonOlder
, pythonAtLeast
, fetchFromGitHub
, pyparsing
, opencascade-occt
, stdenv
, python
, cmake
, swig
, freetype
, libGL
, libGLU
, libX11
, six
, pytest
, makeFontsConf
, freefont_ttf
, Cocoa
}:

let
  pythonocc-core-cadquery = toPythonModule (stdenv.mkDerivation {
    pname = "pythonocc-core-cadquery";
    version = "0.18.2";
    format = "setuptools";

    src = fetchFromGitHub {
      owner = "CadQuery";
      repo = "pythonocc-core";
      # no proper release to to use, this commit copied from the Anaconda receipe
      rev = "701e924ae40701cbe6f9992bcbdc2ef22aa9b5ab";
      sha256 = "07zmiiw74dyj4v0ar5vqkvk30wzcpjjzbi04nsdk5mnlzslmyi6c";
    };

    nativeBuildInputs = [
      cmake
      swig
    ];

    buildInputs = [
      python
      opencascade-occt
      freetype
      libGL
      libGLU
      libX11
    ] ++ lib.optionals stdenv.isDarwin [ Cocoa ];

    propagatedBuildInputs = [
      six
    ];

    cmakeFlags = [
      "-Wno-dev"
      "-DPYTHONOCC_INSTALL_DIRECTORY=${placeholder "out"}/${python.sitePackages}/OCC"
    ];
  });

in
  buildPythonPackage rec {
    pname = "cadquery";
    version = "2.0";

    src = fetchFromGitHub {
      owner = "CadQuery";
      repo = pname;
      rev = version;
      sha256 = "1n63b6cjjrdwdfmwq0zx1xabjnhndk9mgfkm4w7z9ardcfpvg84l";
    };

    buildInputs = [
      opencascade-occt
    ];

    propagatedBuildInputs = [
      pyparsing
      pythonocc-core-cadquery
    ];

    FONTCONFIG_FILE = makeFontsConf {
      fontDirectories = [ freefont_ttf ];
    };

    nativeCheckInputs = [
      pytest
    ];

    disabled = pythonOlder "3.6" || pythonAtLeast "3.8";

    meta = with lib; {
      description = "Parametric scripting language for creating and traversing CAD models";
      homepage = "https://github.com/CadQuery/cadquery";
      license = licenses.asl20;
      maintainers = with maintainers; [ marcus7070 ];
      broken = true;
    };
  }