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

64 lines
2 KiB
Nix
Raw Normal View History

{ mkDerivation, lib, fetchFromGitHub, cmake, python3, qtbase, qtquickcontrols2, qtgraphicaleffects, curaengine, plugins ? [] }:
2017-05-17 21:26:11 +02:00
mkDerivation rec {
2019-08-08 09:00:41 +02:00
pname = "cura";
version = "4.2.1";
2014-03-25 23:17:17 +01:00
src = fetchFromGitHub {
owner = "Ultimaker";
repo = "Cura";
rev = version;
2019-08-08 09:00:41 +02:00
sha256 = "1qnai8vmgy5lx3lapw96j41i8mw9p6r99i3qzs709l9yzrix6l86";
2014-03-25 23:17:17 +01:00
};
2018-05-15 10:48:56 +02:00
materials = fetchFromGitHub {
owner = "Ultimaker";
repo = "fdm_materials";
2019-08-08 09:00:41 +02:00
rev = "4.2.0"; # TODO: change back to `version` after 4.2.1
sha256 = "17x43v0np58qbdfk3wz1k7i9pl0plndx9gmf7y0n23nl9f1qzb0m";
2018-05-15 10:48:56 +02:00
};
2019-04-04 09:52:38 +02:00
buildInputs = [ qtbase qtquickcontrols2 qtgraphicaleffects ];
2018-12-27 03:20:25 +01:00
propagatedBuildInputs = with python3.pkgs; [
libsavitar numpy-stl pyserial requests uranium zeroconf
] ++ plugins;
2017-05-17 21:26:11 +02:00
nativeBuildInputs = [ cmake python3.pkgs.wrapPython ];
2014-03-25 23:17:17 +01:00
2018-06-07 11:56:12 +02:00
cmakeFlags = [
"-DURANIUM_DIR=${python3.pkgs.uranium.src}"
"-DCURA_VERSION=${version}"
];
2014-03-25 23:17:17 +01:00
2019-08-08 09:01:10 +02:00
makeWrapperArgs = [
# hacky workaround for https://github.com/NixOS/nixpkgs/issues/59901
"--set OMP_NUM_THREADS 1"
];
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
'';
2014-03-25 23:17:17 +01:00
2018-05-15 10:48:56 +02:00
postInstall = ''
mkdir -p $out/share/cura/resources/materials
cp ${materials}/*.fdm_material $out/share/cura/resources/materials/
mkdir -p $out/lib/cura/plugins
for plugin in ${toString plugins}; do
ln -s $plugin/lib/cura/plugins/* $out/lib/cura/plugins
done
2018-05-15 10:48:56 +02:00
'';
postFixup = ''
2014-03-25 23:17:17 +01:00
wrapPythonPrograms
2019-08-09 12:11:58 +02:00
wrapQtApp $out/bin/cura
2014-03-25 23:17:17 +01:00
'';
2017-05-17 21:26:11 +02:00
meta = with lib; {
description = "3D printer / slicing GUI built on top of the Uranium framework";
homepage = https://github.com/Ultimaker/Cura;
2018-12-27 03:20:25 +01:00
license = licenses.lgpl3Plus;
2014-03-25 23:17:17 +01:00
platforms = platforms.linux;
2019-08-08 09:09:25 +02:00
maintainers = with maintainers; [ abbradar gebner ];
2014-03-25 23:17:17 +01:00
};
}