2020-10-16 20:44:37 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2021-04-13 19:44:15 +00:00
|
|
|
, electron
|
2020-04-24 23:36:52 +00:00
|
|
|
, common-updater-scripts
|
|
|
|
, writeShellScript
|
2020-10-16 20:44:37 +00:00
|
|
|
, makeDesktopItem
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-10-16 20:44:37 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "stretchly";
|
2021-12-06 16:07:01 +00:00
|
|
|
version = "1.8.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/hovancik/stretchly/releases/download/v${version}/stretchly-${version}.tar.xz";
|
2021-12-06 16:07:01 +00:00
|
|
|
sha256 = "sha256-/v74vDGxD5iiOPeBXPAaV42JpyBjeJSO/Lk88pCkDng=";
|
2020-10-16 20:44:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
icon = fetchurl {
|
|
|
|
url = "https://raw.githubusercontent.com/hovancik/stretchly/v${version}/stretchly_128x128.png";
|
|
|
|
sha256 = "0whfg1fy2hjyk1lzpryikc1aj8agsjhfrb0bf7ggl6r9m8s1rvdl";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/bin $out/share/${pname}/
|
2021-12-06 16:07:01 +00:00
|
|
|
mv resources/app.asar* $out/share/${pname}/
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
mkdir -p $out/share/applications
|
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications/
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
|
2020-10-16 20:44:37 +00:00
|
|
|
--add-flags $out/share/${pname}/app.asar
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = writeShellScript "update-stretchly" ''
|
|
|
|
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..."
|
|
|
|
|
|
|
|
${common-updater-scripts}/bin/update-source-version stretchly "$latest_version"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = pname;
|
|
|
|
exec = pname;
|
|
|
|
icon = icon;
|
|
|
|
desktopName = "Stretchly";
|
|
|
|
genericName = "Stretchly";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Utility" ];
|
2020-10-16 20:44:37 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00: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.
|
|
|
|
'';
|
|
|
|
homepage = "https://hovancik.net/stretchly";
|
|
|
|
downloadPage = "https://hovancik.net/stretchly/downloads/";
|
|
|
|
license = licenses.bsd2;
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ _1000101 oxalica ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|