nixpkgs/pkgs/applications/misc/cura/default.nix

72 lines
2.0 KiB
Nix
Raw Normal View History

2014-09-04 16:04:53 +01:00
{ stdenv, python27Packages, curaengine, makeDesktopItem, fetchurl }:
2014-03-25 22:17:17 +00:00
let
2014-09-26 11:12:14 +01:00
py = python27Packages;
2015-08-21 14:42:49 +01:00
version = "15.04";
2014-03-25 22:17:17 +00:00
in
stdenv.mkDerivation rec {
2014-09-26 11:12:14 +01:00
name = "cura-${version}";
2014-03-25 22:17:17 +00:00
2014-09-04 16:04:53 +01:00
src = fetchurl {
url = "https://github.com/daid/Cura/archive/${version}.tar.gz";
2015-08-21 14:42:49 +01:00
sha256 = "0xbjvzhp8wzq9lnpmcg1fjf7j5h39bj5463sd5c8jzdjl96izizl";
2014-03-25 22:17:17 +00:00
};
desktopItem = makeDesktopItem {
name = "Cura";
exec = "cura";
icon = "cura";
comment = "Cura";
desktopName = "Cura";
genericName = "3D printing host software";
categories = "GNOME;GTK;Utility;";
};
2014-09-26 11:12:14 +01:00
python_deps = with py; [ pyopengl pyserial numpy wxPython30 power setuptools ];
2014-03-25 22:17:17 +00:00
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;
2014-09-04 16:04:53 +01:00
maintainers = with stdenv.lib.maintainers; [ the-kenny ];
2014-03-25 22:17:17 +00:00
};
}