From 59f910fe3f92420e5f68f0090cddb29f59a5d97b Mon Sep 17 00:00:00 2001 From: xeals Date: Thu, 21 Sep 2023 13:11:49 +1000 Subject: [PATCH] cura5: rework to include desktop item --- pkgs/by-name/cu/cura5/package.nix | 63 +++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/pkgs/by-name/cu/cura5/package.nix b/pkgs/by-name/cu/cura5/package.nix index 9586266..661bc5f 100644 --- a/pkgs/by-name/cu/cura5/package.nix +++ b/pkgs/by-name/cu/cura5/package.nix @@ -1,7 +1,10 @@ -{ stdenv +{ lib +, stdenv , fetchurl , writeScriptBin , appimageTools +, copyDesktopItems +, makeDesktopItem }: let @@ -33,7 +36,59 @@ let exec "${cura5}/bin/${name}" "''${args[@]}" ''; in -script // { - inherit name pname version; - meta.platforms = [ "x86_64-linux" ]; +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" ]; + }; }