1 { lib, stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE
2 , libXext , freetype, libXrender, fontconfig, libXft, libXinerama
3 , libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3
4 , curl, writeShellScript, common-updater-scripts, xmlstarlet }:
7 url = "https://app.hubstaff.com/download/8099-standard-linux-1-6-26-release";
8 version = "1.6.26-95441346";
9 sha256 = "sha256:0xxw2za1hmqff5y0vyrvccgldsgyb808dql548c2xqsc1qi9gbn9";
11 rpath = lib.makeLibraryPath
12 [ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft
13 libXinerama stdenv.cc.cc libnotify glib gtk3 libappindicator-gtk3
14 curl libXfixes libXScrnSaver ];
22 src = fetchurl { inherit sha256 url; };
24 nativeBuildInputs = [ unzip makeWrapper ];
27 # MojoSetups have a ZIP file at the end. ZIP’s magic string is
28 # most often PK\x03\x04. This has worked for all past updates,
29 # but feel free to come up with something more reasonable.
30 dataZipOffset=$(grep --max-count=1 --byte-offset --only-matching --text ''$'PK\x03\x04' $curSrc | cut -d: -f1)
31 dd bs=$dataZipOffset skip=1 if=$curSrc of=data.zip 2>/dev/null
32 unzip -q data.zip "data/*"
39 # remove files for 32-bit arch to skip building for this arch
40 # but add -f flag to not fail if files were not found (new versions dont provide 32-bit arch)
41 rm -rf x86 x86_64/lib64
44 mkdir -p $out/bin $opt
47 for f in "$opt/x86_64/"*.bin.x86_64 ; do
48 patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) $f
49 wrapProgram $f --prefix LD_LIBRARY_PATH : ${rpath}
52 ln -s $opt/x86_64/HubstaffClient.bin.x86_64 $out/bin/HubstaffClient
53 ln -s $opt/x86_64/HubstaffCLI.bin.x86_64 $out/bin/HubstaffCLI
55 # Why is this needed? SEGV otherwise.
56 ln -s $opt/data/resources $opt/x86_64/resources
60 # nix-shell maintainers/scripts/update.nix --argstr package hubstaff
61 # nix-build -A pkgs.hubstaff
62 passthru.updateScript = writeShellScript "hubstaff-updater" ''
65 # Create a temporary file
68 # Fetch the appcast.xml and save it to the temporary file
69 curl --silent --output "$temp_file" https://app.hubstaff.com/appcast.xml
71 # Extract the latest release URL for Linux using xmlstarlet
72 installation_script_url=$(${xmlstarlet}/bin/xmlstarlet sel -t -v '//enclosure[@sparkle:os="linux"]/@url' "$temp_file")
73 version=$(${xmlstarlet}/bin/xmlstarlet sel -t -v '//enclosure[@sparkle:os="linux"]/@sparkle:version' "$temp_file")
75 sha256=$(nix-prefetch-url "$installation_script_url")
77 ${common-updater-scripts}/bin/update-source-version hubstaff "$version" "sha256:$sha256" "$installation_script_url"
81 description = "Time tracking software";
82 homepage = "https://hubstaff.com/";
83 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
84 license = licenses.unfree;
85 platforms = [ "x86_64-linux" ];
86 maintainers = with maintainers; [ michalrus srghma ];