nixpkgs/pkgs/applications/misc/cura/default.nix
2018-12-27 02:21:02 +00:00

54 lines
1.6 KiB
Nix

{ mkDerivation, lib, fetchFromGitHub, cmake, python3, qtbase, qtquickcontrols2, curaengine }:
mkDerivation rec {
name = "cura-${version}";
version = "3.6.0";
src = fetchFromGitHub {
owner = "Ultimaker";
repo = "Cura";
rev = version;
sha256 = "0wzkbqdd1670smw1vnq634rkpcjwnhwcvimhvjq904gy2fylgr90";
};
materials = fetchFromGitHub {
owner = "Ultimaker";
repo = "fdm_materials";
rev = version;
sha256 = "0g2dkph0ll7d9109n17vmfwb4fpc8lhyb1z1q68j8vblyvg08d12";
};
buildInputs = [ qtbase qtquickcontrols2 ];
propagatedBuildInputs = with python3.pkgs; [
libsavitar numpy-stl pyserial requests uranium zeroconf
];
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.lgpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ abbradar ];
};
}