2021-01-15 22:18:51 +00:00
|
|
|
|
{ lib, stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE
|
2020-04-24 23:36:52 +00:00
|
|
|
|
, libXext , freetype, libXrender, fontconfig, libXft, libXinerama
|
|
|
|
|
, libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3
|
2024-07-27 06:49:29 +00:00
|
|
|
|
, curl, writeShellScript, common-updater-scripts, xmlstarlet }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
let
|
2024-09-19 14:19:46 +00:00
|
|
|
|
url = "https://app.hubstaff.com/download/8099-standard-linux-1-6-26-release";
|
|
|
|
|
version = "1.6.26-95441346";
|
|
|
|
|
sha256 = "sha256:0xxw2za1hmqff5y0vyrvccgldsgyb808dql548c2xqsc1qi9gbn9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
|
rpath = lib.makeLibraryPath
|
2020-04-24 23:36:52 +00:00
|
|
|
|
[ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft
|
|
|
|
|
libXinerama stdenv.cc.cc.lib libnotify glib gtk3 libappindicator-gtk3
|
|
|
|
|
curl libXfixes libXScrnSaver ];
|
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
pname = "hubstaff";
|
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
|
|
src = fetchurl { inherit sha256 url; };
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip makeWrapper ];
|
|
|
|
|
|
|
|
|
|
unpackCmd = ''
|
|
|
|
|
# MojoSetups have a ZIP file at the end. ZIP’s magic string is
|
|
|
|
|
# most often PK\x03\x04. This has worked for all past updates,
|
|
|
|
|
# but feel free to come up with something more reasonable.
|
|
|
|
|
dataZipOffset=$(grep --max-count=1 --byte-offset --only-matching --text ''$'PK\x03\x04' $curSrc | cut -d: -f1)
|
|
|
|
|
dd bs=$dataZipOffset skip=1 if=$curSrc of=data.zip 2>/dev/null
|
|
|
|
|
unzip -q data.zip "data/*"
|
|
|
|
|
rm data.zip
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
2024-07-27 06:49:29 +00:00
|
|
|
|
# remove files for 32-bit arch to skip building for this arch
|
|
|
|
|
# but add -f flag to not fail if files were not found (new versions dont provide 32-bit arch)
|
|
|
|
|
rm -rf x86 x86_64/lib64
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
opt=$out/opt/hubstaff
|
|
|
|
|
mkdir -p $out/bin $opt
|
|
|
|
|
cp -r . $opt/
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
ln -s $opt/x86_64/HubstaffClient.bin.x86_64 $out/bin/HubstaffClient
|
2024-10-23 06:41:50 +00:00
|
|
|
|
ln -s $opt/x86_64/HubstaffCLI.bin.x86_64 $out/bin/HubstaffCLI
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
# Why is this needed? SEGV otherwise.
|
|
|
|
|
ln -s $opt/data/resources $opt/x86_64/resources
|
|
|
|
|
'';
|
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
|
# to test run:
|
|
|
|
|
# nix-shell maintainers/scripts/update.nix --argstr package hubstaff
|
|
|
|
|
# nix-build -A pkgs.hubstaff
|
2022-04-27 09:35:20 +00:00
|
|
|
|
passthru.updateScript = writeShellScript "hubstaff-updater" ''
|
2021-06-28 23:13:55 +00:00
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
|
# Create a temporary file
|
|
|
|
|
temp_file=$(mktemp)
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
|
# Fetch the appcast.xml and save it to the temporary file
|
|
|
|
|
curl --silent --output "$temp_file" https://app.hubstaff.com/appcast.xml
|
|
|
|
|
|
|
|
|
|
# Extract the latest release URL for Linux using xmlstarlet
|
|
|
|
|
installation_script_url=$(${xmlstarlet}/bin/xmlstarlet sel -t -v '//enclosure[@sparkle:os="linux"]/@url' "$temp_file")
|
|
|
|
|
version=$(${xmlstarlet}/bin/xmlstarlet sel -t -v '//enclosure[@sparkle:os="linux"]/@sparkle:version' "$temp_file")
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
|
|
sha256=$(nix-prefetch-url "$installation_script_url")
|
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
|
${common-updater-scripts}/bin/update-source-version hubstaff "$version" "sha256:$sha256" "$installation_script_url"
|
2021-06-28 23:13:55 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
description = "Time tracking software";
|
|
|
|
|
homepage = "https://hubstaff.com/";
|
2022-06-26 10:26:21 +00:00
|
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
license = licenses.unfree;
|
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
|
maintainers = with maintainers; [ michalrus srghma ];
|
|
|
|
|
};
|
|
|
|
|
}
|