From 2e80b50a7eb7db481ff00b6ae4ab76ece6d245b7 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sun, 26 Feb 2017 01:05:04 +0300 Subject: [PATCH] cura, curaengine: 14.04 -> 2.4.0 Move old Cura to {cura,curaengine}_stable --- nixos/modules/services/misc/octoprint.nix | 2 +- pkgs/applications/misc/cura/default.nix | 79 ++++++------------- pkgs/applications/misc/cura/stable.nix | 73 +++++++++++++++++ pkgs/applications/misc/curaengine/default.nix | 35 ++++---- pkgs/applications/misc/curaengine/stable.nix | 29 +++++++ pkgs/top-level/all-packages.nix | 10 ++- 6 files changed, 149 insertions(+), 79 deletions(-) create mode 100644 pkgs/applications/misc/cura/stable.nix create mode 100644 pkgs/applications/misc/curaengine/stable.nix diff --git a/nixos/modules/services/misc/octoprint.nix b/nixos/modules/services/misc/octoprint.nix index c2b3f63be7d4..8faad46a49f1 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 a53b001b0e98..ff18796e39d6 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 000000000000..a53b001b0e98 --- /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 ce743a008798..08df0cc3e903 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 000000000000..ce743a008798 --- /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/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 46d4d7f8bc98..170fa60c27b2 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 { };