nixpkgs/pkgs/applications/misc/cura/default.nix
2018-07-14 22:54:12 +02:00

52 lines
1.5 KiB
Nix

{ mkDerivation, lib, fetchFromGitHub, cmake, python3, qtbase, qtquickcontrols2, curaengine }:
mkDerivation rec {
name = "cura-${version}";
version = "3.4.1";
src = fetchFromGitHub {
owner = "Ultimaker";
repo = "Cura";
rev = version;
sha256 = "03s9nf1aybbnbf1rzqja41m9g6991bbvrcly1lcrfqksianfn06w";
};
materials = fetchFromGitHub {
owner = "Ultimaker";
repo = "fdm_materials";
rev = "3.4.1";
sha256 = "1pw30clxqd7qgnidsyx6grizvlgfn8rhj6rd5ppkvv3rdjh0gj28";
};
buildInputs = [ qtbase qtquickcontrols2 ];
propagatedBuildInputs = with python3.pkgs; [ uranium zeroconf pyserial numpy-stl ];
nativeBuildInputs = [ cmake python3.pkgs.wrapPython ];
cmakeFlags = [
"-DURANIUM_DIR=${python3.pkgs.uranium.src}"
"-DCURA_VERSION=${version}"
];
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
'';
postInstall = ''
mkdir -p $out/share/cura/resources/materials
cp ${materials}/*.fdm_material $out/share/cura/resources/materials/
'';
postFixup = ''
wrapPythonPrograms
'';
meta = with 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 ];
};
}