2021-01-11 07:54:33 +00:00
|
|
|
|
{ lib, stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE
|
2018-01-27 18:00:54 +00:00
|
|
|
|
, libXext , freetype, libXrender, fontconfig, libXft, libXinerama
|
|
|
|
|
, libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3
|
2021-06-18 11:59:10 +00:00
|
|
|
|
, curl, writeShellScript, common-updater-scripts }:
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
|
|
|
|
let
|
2022-09-08 22:04:37 +00:00
|
|
|
|
url = "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/1.6.7-5c6fee47/Hubstaff-1.6.7-5c6fee47.sh";
|
|
|
|
|
version = "1.6.7-5c6fee47";
|
|
|
|
|
sha256 = "0i0xlabdi4xhjkfwb6s4bwjnl4k3dj15k7aqjilmq5wb4rhhfpws";
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
|
rpath = lib.makeLibraryPath
|
2017-09-01 21:25:31 +00:00
|
|
|
|
[ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft
|
|
|
|
|
libXinerama stdenv.cc.cc.lib libnotify glib gtk3 libappindicator-gtk3
|
2018-01-27 18:00:54 +00:00
|
|
|
|
curl libXfixes libXScrnSaver ];
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2019-08-13 21:52:01 +00:00
|
|
|
|
pname = "hubstaff";
|
|
|
|
|
inherit version;
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
2019-02-12 19:56:49 +00:00
|
|
|
|
src = fetchurl { inherit sha256 url; };
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip makeWrapper ];
|
|
|
|
|
|
|
|
|
|
unpackCmd = ''
|
|
|
|
|
# MojoSetups have a ZIP file at the end. ZIP’s magic string is
|
2018-01-27 18:00:54 +00:00
|
|
|
|
# most often PK\x03\x04. This has worked for all past updates,
|
2017-09-01 21:25:31 +00:00
|
|
|
|
# but feel free to come up with something more reasonable.
|
2017-11-27 07:25:51 +00:00
|
|
|
|
dataZipOffset=$(grep --max-count=1 --byte-offset --only-matching --text ''$'PK\x03\x04' $curSrc | cut -d: -f1)
|
2017-09-01 21:25:31 +00:00
|
|
|
|
dd bs=$dataZipOffset skip=1 if=$curSrc of=data.zip 2>/dev/null
|
|
|
|
|
unzip -q data.zip "data/*"
|
|
|
|
|
rm data.zip
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
# TODO: handle 32-bit arch?
|
|
|
|
|
rm -r x86
|
2018-01-27 18:00:54 +00:00
|
|
|
|
rm -r x86_64/lib64
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
|
|
|
|
opt=$out/opt/hubstaff
|
|
|
|
|
mkdir -p $out/bin $opt
|
|
|
|
|
cp -r . $opt/
|
|
|
|
|
|
2018-01-27 18:00:54 +00:00
|
|
|
|
for f in "$opt/x86_64/"*.bin.x86_64 ; do
|
|
|
|
|
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) $f
|
|
|
|
|
wrapProgram $f --prefix LD_LIBRARY_PATH : ${rpath}
|
|
|
|
|
done
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
2018-01-27 18:00:54 +00:00
|
|
|
|
ln -s $opt/x86_64/HubstaffClient.bin.x86_64 $out/bin/HubstaffClient
|
2017-09-01 21:25:31 +00:00
|
|
|
|
|
|
|
|
|
# Why is this needed? SEGV otherwise.
|
|
|
|
|
ln -s $opt/data/resources $opt/x86_64/resources
|
|
|
|
|
'';
|
|
|
|
|
|
2022-04-23 20:14:14 +00:00
|
|
|
|
passthru.updateScript = writeShellScript "hubstaff-updater" ''
|
2021-06-18 11:59:10 +00:00
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
|
|
installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux)
|
|
|
|
|
|
|
|
|
|
version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/')
|
|
|
|
|
|
|
|
|
|
sha256=$(nix-prefetch-url "$installation_script_url")
|
|
|
|
|
|
|
|
|
|
${common-updater-scripts}/bin/update-source-version hubstaff "$version" "$sha256" "$installation_script_url"
|
|
|
|
|
'';
|
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
|
meta = with lib; {
|
2017-09-01 21:25:31 +00:00
|
|
|
|
description = "Time tracking software";
|
2020-04-01 01:11:51 +00:00
|
|
|
|
homepage = "https://hubstaff.com/";
|
2022-06-04 22:19:25 +00:00
|
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2017-09-01 21:25:31 +00:00
|
|
|
|
license = licenses.unfree;
|
|
|
|
|
platforms = [ "x86_64-linux" ];
|
2019-05-31 09:07:14 +00:00
|
|
|
|
maintainers = with maintainers; [ michalrus srghma ];
|
2017-09-01 21:25:31 +00:00
|
|
|
|
};
|
|
|
|
|
}
|