nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 unzip,
5 fetchurl,
6 writeShellScript,
7 curl,
8 xmlstarlet,
9 gnused,
10 common-updater-scripts,
11}:
12
13let
14 # Monodraw uses build numbers (tracked via Sparkle appcast)
15 # Appcast: https://updates.helftone.com/monodraw/appcast-beta.xml
16 build = "118";
17in
18stdenvNoCC.mkDerivation (finalAttrs: {
19 pname = "monodraw";
20 version = "1.7.1";
21
22 src = fetchurl {
23 url = "https://updates.helftone.com/monodraw/downloads/Monodraw-b${build}.zip";
24 hash = "sha256-7ti/FXoxNMhSYV7TWTeP8mAnCdqukI0SgDdW6RRQsFc=";
25 };
26
27 sourceRoot = ".";
28
29 nativeBuildInputs = [ unzip ];
30
31 installPhase = ''
32 runHook preInstall
33
34 mkdir -p $out/Applications
35 cp -R ./Monodraw.app $out/Applications
36
37 runHook postInstall
38 '';
39
40 passthru = {
41 inherit build;
42 updateScript = writeShellScript "monodraw-update-script" ''
43 set -euo pipefail
44 export PATH="${
45 lib.makeBinPath [
46 curl
47 xmlstarlet
48 gnused
49 common-updater-scripts
50 ]
51 }"
52
53 xml=$(curl -s "https://updates.helftone.com/monodraw/appcast-beta.xml")
54
55 version=$(echo "$xml" | xmlstarlet sel -t -v '//enclosure/@sparkle:shortVersionString')
56 build=$(echo "$xml" | xmlstarlet sel -t -v '//enclosure/@sparkle:version')
57
58 # Update build number in let binding
59 sed -i "s/build = \"[0-9]*\"/build = \"$build\"/" pkgs/by-name/mo/monodraw/package.nix
60
61 # Update version and hash
62 update-source-version monodraw "$version"
63 '';
64 };
65
66 meta = {
67 description = "Powerful ASCII art editor designed for the Mac";
68 homepage = "https://monodraw.helftone.com/";
69 license = lib.licenses.unfree;
70 maintainers = with lib.maintainers; [ delafthi ];
71 platforms = [
72 "x86_64-darwin"
73 "aarch64-darwin"
74 ];
75 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
76 };
77})