2018-01-27 19:00:54 +01:00
|
|
|
|
{ stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE
|
|
|
|
|
, libXext , freetype, libXrender, fontconfig, libXft, libXinerama
|
|
|
|
|
, libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3
|
|
|
|
|
, curl }:
|
2017-09-01 23:25:31 +02:00
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
2018-03-14 10:08:15 +01:00
|
|
|
|
version = "1.3.1-ff75f26";
|
2017-09-01 23:25:31 +02:00
|
|
|
|
|
|
|
|
|
rpath = stdenv.lib.makeLibraryPath
|
|
|
|
|
[ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft
|
|
|
|
|
libXinerama stdenv.cc.cc.lib libnotify glib gtk3 libappindicator-gtk3
|
2018-01-27 19:00:54 +01:00
|
|
|
|
curl libXfixes libXScrnSaver ];
|
2017-09-01 23:25:31 +02:00
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
name = "hubstaff-${version}";
|
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
|
url = "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/${version}/Hubstaff-${version}.sh";
|
2018-03-14 10:08:15 +01:00
|
|
|
|
sha256 = "0jm5l34r6lkfkg8vsdfqbr0axngxznhagwcl9y184lnyji91fmdl";
|
2017-09-01 23:25:31 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip makeWrapper ];
|
|
|
|
|
|
|
|
|
|
unpackCmd = ''
|
|
|
|
|
# MojoSetups have a ZIP file at the end. ZIP’s magic string is
|
2018-01-27 19:00:54 +01:00
|
|
|
|
# most often PK\x03\x04. This has worked for all past updates,
|
2017-09-01 23:25:31 +02:00
|
|
|
|
# but feel free to come up with something more reasonable.
|
2017-11-27 08:25:51 +01:00
|
|
|
|
dataZipOffset=$(grep --max-count=1 --byte-offset --only-matching --text ''$'PK\x03\x04' $curSrc | cut -d: -f1)
|
2017-09-01 23:25:31 +02: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 19:00:54 +01:00
|
|
|
|
rm -r x86_64/lib64
|
2017-09-01 23:25:31 +02:00
|
|
|
|
|
|
|
|
|
opt=$out/opt/hubstaff
|
|
|
|
|
mkdir -p $out/bin $opt
|
|
|
|
|
cp -r . $opt/
|
|
|
|
|
|
2018-01-27 19:00:54 +01: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 23:25:31 +02:00
|
|
|
|
|
2018-01-27 19:00:54 +01:00
|
|
|
|
ln -s $opt/x86_64/HubstaffClient.bin.x86_64 $out/bin/HubstaffClient
|
2017-09-01 23:25:31 +02:00
|
|
|
|
|
|
|
|
|
# Why is this needed? SEGV otherwise.
|
|
|
|
|
ln -s $opt/data/resources $opt/x86_64/resources
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
|
description = "Time tracking software";
|
|
|
|
|
homepage = https://hubstaff.com/;
|
|
|
|
|
license = licenses.unfree;
|
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
|
maintainers = [ maintainers.michalrus ];
|
|
|
|
|
};
|
|
|
|
|
}
|