2023-09-21 13:11:49 +10:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2023-07-15 19:19:55 +10:00
|
|
|
, fetchurl
|
|
|
|
, writeScriptBin
|
|
|
|
, appimageTools
|
2023-09-21 13:11:49 +10:00
|
|
|
, copyDesktopItems
|
|
|
|
, makeDesktopItem
|
2023-07-15 19:19:55 +10:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "cura5";
|
2024-01-04 15:19:32 +11:00
|
|
|
version = "5.6.0";
|
2023-07-15 19:19:55 +10:00
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
|
|
|
cura5 = appimageTools.wrapType2 {
|
|
|
|
inherit pname version;
|
|
|
|
src = fetchurl {
|
2023-10-26 10:07:50 +11:00
|
|
|
url = "https://github.com/Ultimaker/Cura/releases/download/${version}/Ultimaker-Cura-${version}-linux-X64.AppImage";
|
2024-01-04 15:19:32 +11:00
|
|
|
hash = "sha256-EHiWoNpLKHPzv6rZrtNgEr7y//iVcRYeV/TaCn8QpEA=";
|
2023-07-15 19:19:55 +10:00
|
|
|
};
|
|
|
|
extraPkgs = _: [ ];
|
|
|
|
};
|
|
|
|
script = writeScriptBin pname ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
# AppImage version of Cura loses current working directory and treats all paths relateive to $HOME.
|
|
|
|
# So we convert each of the files passed as argument to an absolute path.
|
|
|
|
# This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`.
|
|
|
|
|
|
|
|
args=()
|
|
|
|
for a in "$@"; do
|
|
|
|
if [ -e "$a" ]; then
|
|
|
|
a="$(realpath "$a")"
|
|
|
|
fi
|
|
|
|
args+=("$a")
|
|
|
|
done
|
2024-12-08 12:26:28 +11:00
|
|
|
exec "${cura5}/bin/cura5" "''${args[@]}"
|
2023-07-15 19:19:55 +10:00
|
|
|
'';
|
|
|
|
in
|
2023-09-21 13:11:49 +10:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit pname version;
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ copyDesktopItems ];
|
|
|
|
desktopItems = [
|
|
|
|
# Based on upstream.
|
|
|
|
# https://github.com/Ultimaker/Cura/blob/main/packaging/AppImage/cura.desktop.jinja
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = "cura";
|
|
|
|
desktopName = "UltiMaker Cura";
|
|
|
|
genericName = "3D Printing Software";
|
|
|
|
comment = meta.longDescription;
|
|
|
|
exec = "cura5";
|
|
|
|
icon = "cura-icon";
|
|
|
|
terminal = false;
|
|
|
|
type = "Application";
|
|
|
|
mimeTypes = [
|
|
|
|
"model/stl"
|
|
|
|
"application/vnd.ms-3mfdocument"
|
|
|
|
"application/prs.wavefront-obj"
|
|
|
|
"image/bmp"
|
|
|
|
"image/gif"
|
|
|
|
"image/jpeg"
|
|
|
|
"image/png"
|
|
|
|
"text/x-gcode"
|
|
|
|
"application/x-amf"
|
|
|
|
"application/x-ply"
|
|
|
|
"application/x-ctm"
|
|
|
|
"model/vnd.collada+xml"
|
|
|
|
"model/gltf-binary"
|
|
|
|
"model/gltf+json"
|
|
|
|
"model/vnd.collada+xml+zip"
|
|
|
|
];
|
|
|
|
categories = [ "Graphics" ];
|
|
|
|
keywords = [ "3D" "Printing" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
# TODO: Extract cura-icon from AppImage source.
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp ${script}/bin/cura5 $out/bin/cura5
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "3D printing software";
|
|
|
|
homepage = "https://github.com/ultimaker/cura";
|
|
|
|
longDescription = ''
|
|
|
|
Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great.
|
|
|
|
'';
|
|
|
|
license = lib.licenses.lgpl3;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
};
|
2023-07-15 19:19:55 +10:00
|
|
|
}
|