From 43236beb53c56ff7cce913f8170d84af3e5ae241 Mon Sep 17 00:00:00 2001 From: xeals Date: Sat, 15 Jul 2023 19:19:55 +1000 Subject: [PATCH] cura5: init at 5.4.0 --- pkgs/unit/cu/cura5/package.nix | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pkgs/unit/cu/cura5/package.nix diff --git a/pkgs/unit/cu/cura5/package.nix b/pkgs/unit/cu/cura5/package.nix new file mode 100644 index 0000000..9586266 --- /dev/null +++ b/pkgs/unit/cu/cura5/package.nix @@ -0,0 +1,39 @@ +{ stdenv +, fetchurl +, writeScriptBin +, appimageTools +}: + +let + pname = "cura5"; + version = "5.4.0"; + name = "${pname}-${version}"; + + cura5 = appimageTools.wrapType2 { + inherit pname version; + src = fetchurl { + url = "https://github.com/Ultimaker/Cura/releases/download/${version}/Ultimaker-Cura-${version}-linux-modern.AppImage"; + hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74="; + }; + 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 + exec "${cura5}/bin/${name}" "''${args[@]}" + ''; +in +script // { + inherit name pname version; + meta.platforms = [ "x86_64-linux" ]; +}