2
0
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-18 03:34:58 +00:00
nixpkgs/pkgs/applications/misc/cura/default.nix
Felix Buehler 9812836f38 {cura,curaengine}: 4.10.0 -> 4.12.1,
{libnest2d,libarcus,libsavitar,pynest2d,uranium}: 4.10.0 -> 4.12.0
2021-12-14 16:22:07 +01:00

66 lines
2.0 KiB
Nix

{ mkDerivation, lib, fetchFromGitHub, cmake, python3, qtbase,
qtquickcontrols2, qtgraphicaleffects, curaengine, plugins ? [] }:
mkDerivation rec {
pname = "cura";
version = "4.12.1";
src = fetchFromGitHub {
owner = "Ultimaker";
repo = "Cura";
rev = version;
sha256 = "sha256-QvX9o1nrYmY6zzPcxl+xD6JTMdphzT/is1SMYrISu4o=";
};
materials = fetchFromGitHub {
owner = "Ultimaker";
repo = "fdm_materials";
rev = version;
sha256 = "0ykf14j4yx4cf12qw0d4bff9ixrx96m6wxqvi83sn721y7dsd2rs";
};
buildInputs = [ qtbase qtquickcontrols2 qtgraphicaleffects ];
propagatedBuildInputs = with python3.pkgs; [
libsavitar numpy-stl pyserial requests uranium zeroconf pynest2d
sentry-sdk trimesh keyring
] ++ plugins;
nativeBuildInputs = [ cmake python3.pkgs.wrapPython ];
cmakeFlags = [
"-DURANIUM_DIR=${python3.pkgs.uranium.src}"
"-DCURA_VERSION=${version}"
];
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
'';
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
'';
postFixup = ''
wrapPythonPrograms
wrapQtApp $out/bin/cura
'';
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 gebner ];
};
}