diff --git a/nixos/modules/services/misc/octoprint.nix b/nixos/modules/services/misc/octoprint.nix index c2b3f63be7d..8faad46a49f 100644 --- a/nixos/modules/services/misc/octoprint.nix +++ b/nixos/modules/services/misc/octoprint.nix @@ -7,7 +7,7 @@ let cfg = config.services.octoprint; baseConfig = { - plugins.cura.cura_engine = "${pkgs.curaengine}/bin/CuraEngine"; + plugins.cura.cura_engine = "${pkgs.curaengine_stable}/bin/CuraEngine"; server.host = cfg.host; server.port = cfg.port; webcam.ffmpeg = "${pkgs.ffmpeg.bin}/bin/ffmpeg"; diff --git a/pkgs/applications/misc/cura/default.nix b/pkgs/applications/misc/cura/default.nix index a53b001b0e9..ff18796e39d 100644 --- a/pkgs/applications/misc/cura/default.nix +++ b/pkgs/applications/misc/cura/default.nix @@ -1,73 +1,38 @@ -{ stdenv, python27Packages, curaengine, makeDesktopItem, fetchurl }: -let - py = python27Packages; - version = "15.04"; -in +{ stdenv, lib, fetchFromGitHub, cmake, python3, qtbase, makeQtWrapper, curaengine }: + stdenv.mkDerivation rec { name = "cura-${version}"; + version = "2.4.0"; - src = fetchurl { - url = "https://github.com/daid/Cura/archive/${version}.tar.gz"; - sha256 = "0xbjvzhp8wzq9lnpmcg1fjf7j5h39bj5463sd5c8jzdjl96izizl"; + src = fetchFromGitHub { + owner = "Ultimaker"; + repo = "Cura"; + rev = version; + sha256 = "04iglmjg9rzmlfrll6g7bcckkla327938xh8qmbdfrh215aivdlp"; }; - desktopItem = makeDesktopItem { - name = "Cura"; - exec = "cura"; - icon = "cura"; - comment = "Cura"; - desktopName = "Cura"; - genericName = "3D printing host software"; - categories = "GNOME;GTK;Utility;"; - }; + buildInputs = [ qtbase ]; + propagatedBuildInputs = with python3.pkgs; [ uranium zeroconf pyserial ]; + nativeBuildInputs = [ cmake python3.pkgs.wrapPython makeQtWrapper ]; - python_deps = with py; [ pyopengl pyserial numpy wxPython30 power setuptools ]; + cmakeFlags = [ "-DCMAKE_MODULE_PATH=${python3.pkgs.uranium}/share/cmake-${cmake.majorVersion}/Modules" ]; - pythonPath = python_deps; + 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 + ''; - propagatedBuildInputs = python_deps; - - buildInputs = [ curaengine py.wrapPython ]; - - configurePhase = ""; - buildPhase = ""; - - patches = [ ./numpy-cast.patch ]; - - installPhase = '' - # Install Python code. - site_packages=$out/lib/python2.7/site-packages - mkdir -p $site_packages - cp -r Cura $site_packages/ - - # Install resources. - resources=$out/share/cura - mkdir -p $resources - cp -r resources/* $resources/ - sed -i 's|os.path.join(os.path.dirname(__file__), "../../resources")|"'$resources'"|g' $site_packages/Cura/util/resources.py - - # Install executable. - mkdir -p $out/bin - cp Cura/cura.py $out/bin/cura - chmod +x $out/bin/cura - sed -i 's|#!/usr/bin/python|#!/usr/bin/env python|' $out/bin/cura + postFixup = '' wrapPythonPrograms - - # Make it find CuraEngine. - echo "def getEngineFilename(): return '${curaengine}/bin/CuraEngine'" >> $site_packages/Cura/util/sliceEngine.py - - # Install desktop item. - mkdir -p "$out"/share/applications - cp "$desktopItem"/share/applications/* "$out"/share/applications/ - mkdir -p "$out"/share/icons - ln -s "$resources/images/c.png" "$out"/share/icons/cura.png + mv $out/bin/cura $out/bin/.cura-noqtpath + makeQtWrapper $out/bin/.cura-noqtpath $out/bin/cura ''; meta = with stdenv.lib; { - description = "3D printing host software"; - homepage = https://github.com/daid/Cura; + 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 stdenv.lib.maintainers; [ the-kenny ]; + maintainers = with maintainers; [ abbradar ]; }; } diff --git a/pkgs/applications/misc/cura/stable.nix b/pkgs/applications/misc/cura/stable.nix new file mode 100644 index 00000000000..a53b001b0e9 --- /dev/null +++ b/pkgs/applications/misc/cura/stable.nix @@ -0,0 +1,73 @@ +{ stdenv, python27Packages, curaengine, makeDesktopItem, fetchurl }: +let + py = python27Packages; + version = "15.04"; +in +stdenv.mkDerivation rec { + name = "cura-${version}"; + + src = fetchurl { + url = "https://github.com/daid/Cura/archive/${version}.tar.gz"; + sha256 = "0xbjvzhp8wzq9lnpmcg1fjf7j5h39bj5463sd5c8jzdjl96izizl"; + }; + + desktopItem = makeDesktopItem { + name = "Cura"; + exec = "cura"; + icon = "cura"; + comment = "Cura"; + desktopName = "Cura"; + genericName = "3D printing host software"; + categories = "GNOME;GTK;Utility;"; + }; + + python_deps = with py; [ pyopengl pyserial numpy wxPython30 power setuptools ]; + + pythonPath = python_deps; + + propagatedBuildInputs = python_deps; + + buildInputs = [ curaengine py.wrapPython ]; + + configurePhase = ""; + buildPhase = ""; + + patches = [ ./numpy-cast.patch ]; + + installPhase = '' + # Install Python code. + site_packages=$out/lib/python2.7/site-packages + mkdir -p $site_packages + cp -r Cura $site_packages/ + + # Install resources. + resources=$out/share/cura + mkdir -p $resources + cp -r resources/* $resources/ + sed -i 's|os.path.join(os.path.dirname(__file__), "../../resources")|"'$resources'"|g' $site_packages/Cura/util/resources.py + + # Install executable. + mkdir -p $out/bin + cp Cura/cura.py $out/bin/cura + chmod +x $out/bin/cura + sed -i 's|#!/usr/bin/python|#!/usr/bin/env python|' $out/bin/cura + wrapPythonPrograms + + # Make it find CuraEngine. + echo "def getEngineFilename(): return '${curaengine}/bin/CuraEngine'" >> $site_packages/Cura/util/sliceEngine.py + + # Install desktop item. + mkdir -p "$out"/share/applications + cp "$desktopItem"/share/applications/* "$out"/share/applications/ + mkdir -p "$out"/share/icons + ln -s "$resources/images/c.png" "$out"/share/icons/cura.png + ''; + + meta = with stdenv.lib; { + description = "3D printing host software"; + homepage = https://github.com/daid/Cura; + license = licenses.agpl3; + platforms = platforms.linux; + maintainers = with stdenv.lib.maintainers; [ the-kenny ]; + }; +} diff --git a/pkgs/applications/misc/curaengine/default.nix b/pkgs/applications/misc/curaengine/default.nix index ce743a00879..08df0cc3e90 100644 --- a/pkgs/applications/misc/curaengine/default.nix +++ b/pkgs/applications/misc/curaengine/default.nix @@ -1,29 +1,26 @@ -{ stdenv, fetchurl }: -let - version = "15.04.6"; -in -stdenv.mkDerivation { - name = "curaengine-${version}"; +{ stdenv, fetchFromGitHub, cmake, libarcus }: - src = fetchurl { - url = "https://github.com/Ultimaker/CuraEngine/archive/${version}.tar.gz"; - sha256 = "1cd4dikzvqyj5g80rqwymvh4nwm76vsf78clb37kj6q0fig3qbjg"; +stdenv.mkDerivation rec { + name = "curaengine-${version}"; + version = "2.4.0"; + + src = fetchFromGitHub { + owner = "Ultimaker"; + repo = "CuraEngine"; + rev = version; + sha256 = "1n587cqm310kzb2zbc31199x7ybgxzjq91hslb1zcb8qg8qqmixm"; }; - postPatch = '' - sed -i 's,--static,,g' Makefile - ''; + nativeBuildInputs = [ cmake ]; + buildInputs = [ libarcus ]; - installPhase = '' - mkdir -p $out/bin - cp build/CuraEngine $out/bin/ - ''; + enableParallelBuilding = true; meta = with stdenv.lib; { - description = "Engine for processing 3D models into 3D printing instructions"; - homepage = https://github.com/Ultimaker/CuraEngine; + description = "A powerful, fast and robust engine for processing 3D models into 3D printing instruction"; + homepage = "https://github.com/Ultimaker/CuraEngine"; license = licenses.agpl3; platforms = platforms.linux; - maintainers = with stdenv.lib.maintainers; [ the-kenny ]; + maintainers = with maintainers; [ abbradar ]; }; } diff --git a/pkgs/applications/misc/curaengine/stable.nix b/pkgs/applications/misc/curaengine/stable.nix new file mode 100644 index 00000000000..ce743a00879 --- /dev/null +++ b/pkgs/applications/misc/curaengine/stable.nix @@ -0,0 +1,29 @@ +{ stdenv, fetchurl }: +let + version = "15.04.6"; +in +stdenv.mkDerivation { + name = "curaengine-${version}"; + + src = fetchurl { + url = "https://github.com/Ultimaker/CuraEngine/archive/${version}.tar.gz"; + sha256 = "1cd4dikzvqyj5g80rqwymvh4nwm76vsf78clb37kj6q0fig3qbjg"; + }; + + postPatch = '' + sed -i 's,--static,,g' Makefile + ''; + + installPhase = '' + mkdir -p $out/bin + cp build/CuraEngine $out/bin/ + ''; + + meta = with stdenv.lib; { + description = "Engine for processing 3D models into 3D printing instructions"; + homepage = https://github.com/Ultimaker/CuraEngine; + license = licenses.agpl3; + platforms = platforms.linux; + maintainers = with stdenv.lib.maintainers; [ the-kenny ]; + }; +} diff --git a/pkgs/development/python-modules/libarcus/default.nix b/pkgs/development/python-modules/libarcus/default.nix new file mode 100644 index 00000000000..cae6ac62e1e --- /dev/null +++ b/pkgs/development/python-modules/libarcus/default.nix @@ -0,0 +1,33 @@ +{ stdenv, lib, fetchFromGitHub, python, cmake, sip, protobuf }: + +if lib.versionOlder python.version "3.4.0" +then throw "libArcus not supported for interpreter ${python.executable}" +else + +stdenv.mkDerivation rec { + name = "libarcus-${version}"; + version = "2.4.0"; + + src = fetchFromGitHub { + owner = "Ultimaker"; + repo = "libArcus"; + rev = version; + sha256 = "07lf5d42pnx0h9lgldplfdj142rbcsxx23njdblnq04di7a4937h"; + }; + + propagatedBuildInputs = [ sip protobuf ]; + nativeBuildInputs = [ cmake ]; + + postPatch = '' + # To workaround buggy SIP detection which overrides PYTHONPATH + sed -i '/SET(ENV{PYTHONPATH}/d' cmake/FindSIP.cmake + ''; + + meta = with stdenv.lib; { + description = "Communication library between internal components for Ultimaker software"; + homepage = "https://github.com/Ultimaker/libArcus"; + license = licenses.agpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/development/python-modules/uranium/default.nix b/pkgs/development/python-modules/uranium/default.nix new file mode 100644 index 00000000000..bce88635d3c --- /dev/null +++ b/pkgs/development/python-modules/uranium/default.nix @@ -0,0 +1,37 @@ +{ stdenv, lib, fetchFromGitHub, python, cmake, pyqt5, numpy, scipy, libarcus }: + +if lib.versionOlder python.version "3.5.0" +then throw "Uranium not supported for interpreter ${python.executable}" +else + +stdenv.mkDerivation rec { + name = "uranium-${version}"; + version = "2.4.0"; + + src = fetchFromGitHub { + owner = "Ultimaker"; + repo = "Uranium"; + rev = version; + sha256 = "1jpl0ryk8xdppillk5wzr2415n50cpa09shn1xqj6y96fg22l2il"; + }; + + buildInputs = [ python ]; + propagatedBuildInputs = [ pyqt5 numpy scipy libarcus ]; + nativeBuildInputs = [ cmake ]; + + postPatch = '' + sed -i 's,/python''${PYTHON_VERSION_MAJOR}/dist-packages,/python''${PYTHON_VERSION_MAJOR}.''${PYTHON_VERSION_MINOR}/site-packages,g' CMakeLists.txt + sed -i \ + -e "s,Resources.addSearchPath(os.path.join(os.path.abspath(os.path.dirname(__file__)).*,Resources.addSearchPath(\"$out/share/uranium/resources\")," \ + -e "s,self._plugin_registry.addPluginLocation(os.path.join(os.path.abspath(os.path.dirname(__file__)).*,self._plugin_registry.addPluginLocation(\"$out/lib/uranium/plugins\")," \ + UM/Application.py + ''; + + meta = with stdenv.lib; { + description = "A Python framework for building Desktop applications"; + homepage = "https://github.com/Ultimaker/Uranium"; + license = licenses.agpl3; + platforms = platforms.linux; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 46d4d7f8bc9..170fa60c27b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15270,9 +15270,15 @@ with pkgs; slic3r = callPackage ../applications/misc/slic3r { }; - curaengine = callPackage ../applications/misc/curaengine { }; + curaengine_stable = callPackage ../applications/misc/curaengine/stable.nix { }; + cura_stable = callPackage ../applications/misc/cura/stable.nix { + curaengine = curaengine_stable; + }; - cura = callPackage ../applications/misc/cura { }; + curaengine = callPackage ../applications/misc/curaengine { + inherit (python3.pkgs) libarcus; + }; + cura = qt5.callPackage ../applications/misc/cura { }; curaLulzbot = callPackage ../applications/misc/cura/lulzbot.nix { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index cb6fee5977d..d9ec862146c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10986,6 +10986,26 @@ in { }; }; + enum-compat = buildPythonPackage rec { + pname = "enum-compat"; + version = "0.0.2"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "14j1i963jic2vncbf9k5nq1vvv8pw2zsg7yvwhm7d9c6h7qyz74k"; + }; + + propagatedBuildInputs = with self; [ enum34 ]; + + meta = { + homepage = "https://github.com/jstasiak/enum-compat"; + description = "enum/enum34 compatibility package"; + license = licenses.mit; + maintainers = with maintainers; [ abbradar ]; + }; + }; + enum34 = if pythonAtLeast "3.4" then null else buildPythonPackage rec { pname = "enum34"; version = "1.1.6"; @@ -28129,6 +28149,10 @@ EOF inherit (pkgs) libasyncns pkgconfig; }; + libarcus = callPackage ../development/python-modules/libarcus { + protobuf = self.protobuf3_0; + }; + pybrowserid = buildPythonPackage rec { name = "PyBrowserID-${version}"; version = "0.9.2"; @@ -31986,6 +32010,8 @@ EOF }; }; + uranium = callPackage ../development/python-modules/uranium { }; + urlscan = callPackage ../applications/misc/urlscan { }; vine = buildPythonPackage rec { @@ -32026,6 +32052,26 @@ EOF zeitgeist = if isPy3k then throw "zeitgeist not supported for interpreter ${python.executable}" else (pkgs.zeitgeist.override{python2Packages=self;}).py; + zeroconf = buildPythonPackage rec { + pname = "zeroconf"; + version = "0.18.0"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "0s1840v2h4h19ad8lfadbm3dhzs8bw9c5c3slkxql1zsaiycvjy2"; + }; + + propagatedBuildInputs = with self; [ netifaces six enum-compat ]; + + meta = { + description = "A pure python implementation of multicast DNS service discovery"; + homepage = "https://github.com/jstasiak/python-zeroconf"; + license = licenses.lgpl21; + maintainers = with maintainers; [ abbradar ]; + }; + }; + zipfile36 = buildPythonPackage rec { pname = "zipfile36"; version = "0.1.3";