2020-10-11 09:53:26 +02:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2021-04-13 13:03:34 +02:00
|
|
|
, electron
|
2019-08-30 19:12:04 +02:00
|
|
|
, common-updater-scripts
|
2020-02-13 18:37:38 +01:00
|
|
|
, writeShellScript
|
2020-10-11 09:53:26 +02:00
|
|
|
, makeDesktopItem
|
2019-04-17 19:36:11 +02:00
|
|
|
}:
|
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2020-10-11 09:53:26 +02:00
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
pname = "stretchly";
|
2021-07-28 23:35:43 +02:00
|
|
|
version = "1.7.0";
|
2019-08-30 19:12:04 +02:00
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/hovancik/stretchly/releases/download/v${version}/stretchly-${version}.tar.xz";
|
2021-07-28 23:35:43 +02:00
|
|
|
sha256 = "sha256-F6p+g0yuDMpNq+cVgA3ZhUwCIiIU1QfYM90lmaNnRWw=";
|
2020-10-11 09:53:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
icon = fetchurl {
|
|
|
|
url = "https://raw.githubusercontent.com/hovancik/stretchly/v${version}/stretchly_128x128.png";
|
|
|
|
sha256 = "0whfg1fy2hjyk1lzpryikc1aj8agsjhfrb0bf7ggl6r9m8s1rvdl";
|
2020-02-13 18:37:38 +01:00
|
|
|
};
|
2019-08-30 19:12:04 +02:00
|
|
|
|
2020-10-11 09:53:26 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2019-08-30 19:12:04 +02:00
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2019-04-17 19:36:11 +02:00
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
mkdir -p $out/bin $out/share/${pname}/
|
|
|
|
mv resources/app.asar $out/share/${pname}/
|
2019-04-17 19:36:11 +02:00
|
|
|
|
2020-10-11 09:53:26 +02:00
|
|
|
mkdir -p $out/share/applications
|
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications/
|
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
|
2020-10-11 09:53:26 +02:00
|
|
|
--add-flags $out/share/${pname}/app.asar
|
2019-04-17 19:36:11 +02:00
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2019-04-17 19:36:11 +02:00
|
|
|
|
2019-08-30 19:12:04 +02:00
|
|
|
passthru = {
|
2020-02-13 18:37:38 +01:00
|
|
|
updateScript = writeShellScript "update-stretchly" ''
|
2019-08-30 19:12:04 +02:00
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# get the latest release version
|
|
|
|
latest_version=$(curl -s https://api.github.com/repos/hovancik/stretchly/releases/latest | jq --raw-output .tag_name | sed -e 's/^v//')
|
|
|
|
|
|
|
|
echo "updating to $latest_version..."
|
|
|
|
|
2020-02-13 18:37:38 +01:00
|
|
|
${common-updater-scripts}/bin/update-source-version stretchly "$latest_version"
|
2019-04-17 19:36:11 +02:00
|
|
|
'';
|
2020-02-13 18:37:38 +01:00
|
|
|
};
|
2019-08-30 19:12:04 +02:00
|
|
|
|
2020-10-11 09:53:26 +02:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = pname;
|
|
|
|
exec = pname;
|
|
|
|
icon = icon;
|
|
|
|
desktopName = "Stretchly";
|
|
|
|
genericName = "Stretchly";
|
|
|
|
categories = "Utility;";
|
|
|
|
};
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-02-13 18:37:38 +01:00
|
|
|
description = "A break time reminder app";
|
|
|
|
longDescription = ''
|
|
|
|
stretchly is a cross-platform electron app that reminds you to take
|
|
|
|
breaks when working on your computer. By default, it runs in your tray
|
|
|
|
and displays a reminder window containing an idea for a microbreak for 20
|
|
|
|
seconds every 10 minutes. Every 30 minutes, it displays a window
|
|
|
|
containing an idea for a longer 5 minute break.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://hovancik.net/stretchly";
|
|
|
|
downloadPage = "https://hovancik.net/stretchly/downloads/";
|
2020-02-13 18:37:38 +01:00
|
|
|
license = licenses.bsd2;
|
2020-10-11 09:53:26 +02:00
|
|
|
maintainers = with maintainers; [ _1000101 ];
|
2020-02-13 18:37:38 +01:00
|
|
|
platforms = platforms.linux;
|
2019-04-17 19:36:11 +02:00
|
|
|
};
|
|
|
|
}
|