From 5f2167627eb7ee0d43bdd5898cbf8dee05665fd4 Mon Sep 17 00:00:00 2001 From: "ambrop7@gmail.com" Date: Tue, 25 Mar 2014 23:17:17 +0100 Subject: [PATCH] Add Cura. --- pkgs/applications/misc/cura/default.nix | 71 +++++++++++++++++++ pkgs/applications/misc/curaengine/default.nix | 22 ++++++ pkgs/top-level/all-packages.nix | 4 ++ 3 files changed, 97 insertions(+) create mode 100644 pkgs/applications/misc/cura/default.nix create mode 100644 pkgs/applications/misc/curaengine/default.nix diff --git a/pkgs/applications/misc/cura/default.nix b/pkgs/applications/misc/cura/default.nix new file mode 100644 index 000000000000..937025c08403 --- /dev/null +++ b/pkgs/applications/misc/cura/default.nix @@ -0,0 +1,71 @@ +{ stdenv, python27Packages, curaengine, makeDesktopItem, fetchgit }: +let + py = python27Packages; +in +stdenv.mkDerivation rec { + name = "cura"; + + src = fetchgit { + url = "https://github.com/daid/Cura"; + rev = "58414695269d60ca9b165e8cbc3424933ed79403"; + sha256 = "1nxrrz8sjjx9i9cyvz15vay6yarnywp3vlk7qzr65sw88lzxgq23"; + fetchSubmodules = false; + }; + + desktopItem = makeDesktopItem { + name = "Cura"; + exec = "cura"; + icon = "cura"; + comment = "Cura"; + desktopName = "Cura"; + genericName = "3D printing host software"; + categories = "GNOME;GTK;Utility;"; + }; + + python_deps = [ py.pyopengl py.pyserial py.numpy py.wxPython30 py.power py.setuptools ]; + + pythonPath = python_deps; + + propagatedBuildInputs = python_deps; + + buildInputs = [ curaengine py.wrapPython ]; + + configurePhase = ""; + buildPhase = ""; + + 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; + }; +} diff --git a/pkgs/applications/misc/curaengine/default.nix b/pkgs/applications/misc/curaengine/default.nix new file mode 100644 index 000000000000..256d337f679e --- /dev/null +++ b/pkgs/applications/misc/curaengine/default.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchgit }: +stdenv.mkDerivation { + name = "curaengine"; + + src = fetchgit { + url = "https://github.com/Ultimaker/CuraEngine"; + rev = "62667ff2e7479b55d75e3d1dc9136242adf4a6a0"; + sha256 = "0c68xmnq4c49vzg2cyqb375kc72rcnghj21wp3919w8sfwil00vr"; + }; + + installPhase = '' + mkdir -p $out/bin + cp 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; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 24f1543fc83d..29251a513dde 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8939,6 +8939,10 @@ let perl = perl514; }; + curaengine = callPackage ../applications/misc/curaengine { }; + + cura = callPackage ../applications/misc/cura { }; + slim = callPackage ../applications/display-managers/slim { libpng = libpng12; };