nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 fetchurl,
5 writeShellApplication,
6 cacert,
7 curl,
8 common-updater-scripts,
9 pup,
10 undmg,
11}:
12
13stdenvNoCC.mkDerivation (finalAttrs: {
14 pname = "shottr";
15 version = "1.8.1";
16
17 src = fetchurl {
18 url = "https://shottr.cc/dl/Shottr-${finalAttrs.version}.dmg";
19 hash = "sha256-I3LNLuhIRdjKDn79HWRK2B/tVsV+1aGt/aY442y3r2I=";
20 };
21
22 nativeBuildInputs = [ undmg ];
23
24 sourceRoot = ".";
25
26 installPhase = ''
27 runHook preInstall
28
29 mkdir -p "$out/Applications"
30 cp -R Shottr.app "$out/Applications"
31
32 mkdir -p "$out/bin"
33 ln -s "$out/Applications/Shottr.app/Contents/MacOS/Shottr" "$out/bin/shottr"
34
35 runHook postInstall
36 '';
37
38 passthru.updateScript = lib.getExe (writeShellApplication {
39 name = "shottr-update-script";
40 runtimeInputs = [
41 cacert
42 common-updater-scripts
43 curl
44 pup
45 ];
46 text = ''
47 version="$(curl -s https://shottr.cc/newversion.html \
48 | pup 'a[href*="Shottr-"] attr{href}' \
49 | sed -E 's|/dl/Shottr-||' \
50 | sed -E 's|\.dmg||')"
51 update-source-version shottr "$version"
52 '';
53 });
54
55 meta = {
56 changelog = "https://shottr.cc/newversion.html";
57 description = "MacOS screenshot app with scrolling screenshots, OCR, annotation and measurement instruments";
58 homepage = "https://shottr.cc/";
59 license = lib.licenses.unfree;
60 mainProgram = "shottr";
61 maintainers = with lib.maintainers; [ donteatoreo ];
62 platforms = lib.platforms.darwin;
63 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
64 };
65})