nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, fetchurl
4, makeWrapper
5, electron
6, common-updater-scripts
7, writeShellScript
8, makeDesktopItem
9}:
10
11stdenv.mkDerivation rec {
12
13 pname = "stretchly";
14 version = "1.8.1";
15
16 src = fetchurl {
17 url = "https://github.com/hovancik/stretchly/releases/download/v${version}/stretchly-${version}.tar.xz";
18 sha256 = "sha256-/v74vDGxD5iiOPeBXPAaV42JpyBjeJSO/Lk88pCkDng=";
19 };
20
21 icon = fetchurl {
22 url = "https://raw.githubusercontent.com/hovancik/stretchly/v${version}/stretchly_128x128.png";
23 sha256 = "0whfg1fy2hjyk1lzpryikc1aj8agsjhfrb0bf7ggl6r9m8s1rvdl";
24 };
25
26 nativeBuildInputs = [ makeWrapper ];
27
28 installPhase = ''
29 runHook preInstall
30
31 mkdir -p $out/bin $out/share/${pname}/
32 mv resources/app.asar* $out/share/${pname}/
33
34 mkdir -p $out/share/applications
35 ln -s ${desktopItem}/share/applications/* $out/share/applications/
36
37 makeWrapper ${electron}/bin/electron $out/bin/${pname} \
38 --add-flags $out/share/${pname}/app.asar
39
40 runHook postInstall
41 '';
42
43 passthru = {
44 updateScript = writeShellScript "update-stretchly" ''
45 set -eu -o pipefail
46
47 # get the latest release version
48 latest_version=$(curl -s https://api.github.com/repos/hovancik/stretchly/releases/latest | jq --raw-output .tag_name | sed -e 's/^v//')
49
50 echo "updating to $latest_version..."
51
52 ${common-updater-scripts}/bin/update-source-version stretchly "$latest_version"
53 '';
54 };
55
56 desktopItem = makeDesktopItem {
57 name = pname;
58 exec = pname;
59 icon = icon;
60 desktopName = "Stretchly";
61 genericName = "Stretchly";
62 categories = [ "Utility" ];
63 };
64
65 meta = with lib; {
66 description = "A break time reminder app";
67 longDescription = ''
68 stretchly is a cross-platform electron app that reminds you to take
69 breaks when working on your computer. By default, it runs in your tray
70 and displays a reminder window containing an idea for a microbreak for 20
71 seconds every 10 minutes. Every 30 minutes, it displays a window
72 containing an idea for a longer 5 minute break.
73 '';
74 homepage = "https://hovancik.net/stretchly";
75 downloadPage = "https://hovancik.net/stretchly/downloads/";
76 license = licenses.bsd2;
77 maintainers = with maintainers; [ _1000101 oxalica ];
78 platforms = platforms.linux;
79 };
80}