summary refs log tree commit diff
path: root/pkgs/applications/misc/cura/default.nix
blob: ff18796e39d605b4589d1693fe3dc37ee4a1316a (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
{ stdenv, lib, fetchFromGitHub, cmake, python3, qtbase, makeQtWrapper, curaengine }:

stdenv.mkDerivation rec {
  name = "cura-${version}";
  version = "2.4.0";

  src = fetchFromGitHub {
    owner = "Ultimaker";
    repo = "Cura";
    rev = version;
    sha256 = "04iglmjg9rzmlfrll6g7bcckkla327938xh8qmbdfrh215aivdlp";
  };

  buildInputs = [ qtbase ];
  propagatedBuildInputs = with python3.pkgs; [ uranium zeroconf pyserial ];
  nativeBuildInputs = [ cmake python3.pkgs.wrapPython makeQtWrapper ];

  cmakeFlags = [ "-DCMAKE_MODULE_PATH=${python3.pkgs.uranium}/share/cmake-${cmake.majorVersion}/Modules" ];

  postPatch = ''
    sed -i 's,/python''${PYTHON_VERSION_MAJOR}/dist-packages,/python''${PYTHON_VERSION_MAJOR}.''${PYTHON_VERSION_MINOR}/site-packages,g' CMakeLists.txt
    sed -i 's, executable_name = .*, executable_name = "${curaengine}/bin/CuraEngine",' plugins/CuraEngineBackend/CuraEngineBackend.py
  '';

  postFixup = ''
    wrapPythonPrograms
    mv $out/bin/cura $out/bin/.cura-noqtpath
    makeQtWrapper $out/bin/.cura-noqtpath $out/bin/cura
  '';

  meta = with stdenv.lib; {
    description = "3D printer / slicing GUI built on top of the Uranium framework";
    homepage = "https://github.com/Ultimaker/Cura";
    license = licenses.agpl3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ abbradar ];
  };
}