From f0ac7dfbc3bad1ab0d1d5f1f24d10d714b7fe96d Mon Sep 17 00:00:00 2001 From: Thierry Delafontaine Date: Sat, 8 Nov 2025 21:11:37 +0100 Subject: [PATCH] monodraw: init at 1.7.1 --- pkgs/by-name/mo/monodraw/package.nix | 77 ++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 pkgs/by-name/mo/monodraw/package.nix diff --git a/pkgs/by-name/mo/monodraw/package.nix b/pkgs/by-name/mo/monodraw/package.nix new file mode 100644 index 000000000000..3a80b9f382bf --- /dev/null +++ b/pkgs/by-name/mo/monodraw/package.nix @@ -0,0 +1,77 @@ +{ + lib, + stdenvNoCC, + unzip, + fetchurl, + writeShellScript, + curl, + xmlstarlet, + gnused, + common-updater-scripts, +}: + +let + # Monodraw uses build numbers (tracked via Sparkle appcast) + # Appcast: https://updates.helftone.com/monodraw/appcast-beta.xml + build = "118"; +in +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "monodraw"; + version = "1.7.1"; + + src = fetchurl { + url = "https://updates.helftone.com/monodraw/downloads/Monodraw-b${build}.zip"; + hash = "sha256-7ti/FXoxNMhSYV7TWTeP8mAnCdqukI0SgDdW6RRQsFc="; + }; + + sourceRoot = "."; + + nativeBuildInputs = [ unzip ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/Applications + cp -R ./Monodraw.app $out/Applications + + runHook postInstall + ''; + + passthru = { + inherit build; + updateScript = writeShellScript "monodraw-update-script" '' + set -euo pipefail + export PATH="${ + lib.makeBinPath [ + curl + xmlstarlet + gnused + common-updater-scripts + ] + }" + + xml=$(curl -s "https://updates.helftone.com/monodraw/appcast-beta.xml") + + version=$(echo "$xml" | xmlstarlet sel -t -v '//enclosure/@sparkle:shortVersionString') + build=$(echo "$xml" | xmlstarlet sel -t -v '//enclosure/@sparkle:version') + + # Update build number in let binding + sed -i "s/build = \"[0-9]*\"/build = \"$build\"/" pkgs/by-name/mo/monodraw/package.nix + + # Update version and hash + update-source-version monodraw "$version" + ''; + }; + + meta = { + description = "Powerful ASCII art editor designed for the Mac"; + homepage = "https://monodraw.helftone.com/"; + license = lib.licenses.unfree; + maintainers = with lib.maintainers; [ delafthi ]; + platforms = [ + "x86_64-darwin" + "aarch64-darwin" + ]; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + }; +})