nixpkgs/pkgs/applications/misc/cura/default.nix
Niklas Hambüchen 50c8701d51 cura, python3Packages.libsavitar, python3Packages.libarcus, python3Packages.uranium: 4.3.0 -> 4.4.0
Closes #74134.

Note the `cura.materials` hash is not updated because apparently
its contents stay the same, despite version update.

Implements comment about libarcus from:
https://github.com/NixOS/nixpkgs/pull/69435#issuecomment-535465040
2019-12-07 02:58:37 +01:00

64 lines
1.9 KiB
Nix

{ mkDerivation, lib, fetchFromGitHub, cmake, python3, qtbase, qtquickcontrols2, qtgraphicaleffects, curaengine, plugins ? [] }:
mkDerivation rec {
pname = "cura";
version = "4.4.0";
src = fetchFromGitHub {
owner = "Ultimaker";
repo = "Cura";
rev = "v${version}";
sha256 = "131n36qhdfky584wr3zv73ckjjprwaqb5fih8yln2syf8b7ziwlz";
};
materials = fetchFromGitHub {
owner = "Ultimaker";
repo = "fdm_materials";
rev = version;
sha256 = "141cv1f2pv2pznhgj32zg8bw3kmw9002g6rx16jq7lhclr0x3xls";
};
buildInputs = [ qtbase qtquickcontrols2 qtgraphicaleffects ];
propagatedBuildInputs = with python3.pkgs; [
libsavitar numpy-stl pyserial requests uranium zeroconf
] ++ 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 ];
};
}