96 lines
5.5 KiB
Nix
96 lines
5.5 KiB
Nix
|
{ lib, stdenv, fetchurl, dpkg, wrapGAppsHook, autoPatchelfHook
|
||
|
, alsa-lib, atk, at-spi2-atk, at-spi2-core, cairo, cups, dbus, expat, fontconfig, freetype
|
||
|
, gdk-pixbuf, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid, libX11, libxcb
|
||
|
, libXcomposite, libXcursor, libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender
|
||
|
, libXScrnSaver, libXtst, mesa, nspr, nss, openssl, pango, systemd, writeText, runCommandLocal, wget, cacert }:
|
||
|
|
||
|
stdenv.mkDerivation rec {
|
||
|
pname = "upwork";
|
||
|
version = "5.6.10.13";
|
||
|
|
||
|
# src = unstable.fetchurl {
|
||
|
# url = "https://upwork-usw2-desktopapp.upwork.com/binaries/v5_6_10_13_3c485d1dd2af4f61/upwork_5.6.10.13_amd64.deb";
|
||
|
# sha256 = "c3e1ecf14c99596f434edf93a2e08f031fbaa167025d1280cf19f68b829d6b79";
|
||
|
# curlOpts = "-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0'";
|
||
|
# curlOptsList = [ "-A" "Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0" "-b" "__cf_bm=sANcdpTto.J0mvbyR.an5GsLDsQCJSXBGYfyjgunudo-1662562397-0-ASEouhG8q62/uasIIliDbQ7FlrOwbWzjRBA4OMbJWiqT4tGLltuGF6Ie+LTxbRSAgz0IN8zEPFwhRvafgX74FBo=; __cfruid=815f8a0964f6a5c305ed144e5e7e2d80cc9f0741-1662562397; visitor_id=206.72.224.198.1662562397138000; restriction_verified=1; device_view=full; _vwo_uuid_v2=DDA36742368E9CD6C22F53461B8FEEABA|50367cf62836a04346162fc4c1163283; _gcl_au=1.1.2059070430.1662562398; _vis_opt_s=1|; _vis_opt_test_cookie=1; _gid=GA1.2.553657708.1662562398; _dc_gtm_UA-62227314-1=1; _dc_gtm_UA-62227314-13=1; _vwo_uuid=DDA36742368E9CD6C22F53461B8FEEABA; _vwo_ds=3$1662562396:53.20652988::; visitor_gql_token=oauth2v2_ab94de76be789a51cba51004ca21879b; _rdt_uuid=1662562398232.17176ea2-719b-40cc-af58-08ead2ba4072; _dpm_ses.5831=*; _fbp=fb.1.1662562398279.1023669369; IR_gbd=upwork.com; _gat_UA-64221313-1=1; __zlcmid=1BqlD286zdYpwIv; _gat_UA-62227314-2=1; OptanonConsent=isGpcEnabled=0&datestamp=Wed+Sep+07+2022+09:53:41+GMT-0500+(Central+Daylight+Time)&version=6.39.0&isIABGlobal=false&hosts=&consentId=3b1a413f-0977-4640-8197-e1a4a70c1aea&interactionCount=1&landingPath=NotLandingPage&groups=C0001:1,C0002:1,C0003:1,C0004:1&AwaitingReconsent=false; _ga_KSM221PNDX=GS1.1.1662562397.1.1.1662562421.0.0.0; _ga=GA1.2.322812467.1662562398; _vwo_sn=0:2; XSRF-TOKEN=d329e97c639af9152d630ae40cfb003b; IR_13634=1662562421585|0|1662562421585||; _dpm_id.5831=af23981a-f6c8-4232-9e05-9b0a33aacac2.1662562398.1.1662562422.1662562398.b8c5ca2e-c751-4c02-a565-8658fa25c9c4; spt=9b1c86d6-d343-47e2-8303-94a9d251d4fb" ];
|
||
|
# curlOpts = "-A Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0";
|
||
|
# };
|
||
|
|
||
|
src = runCommandLocal "upwork_5.6.10.13_amd64.deb"
|
||
|
rec {
|
||
|
# outputHashMode = "recursive";
|
||
|
# outputHashAlgo = "sha256";
|
||
|
# outputHash = "sha256-VEncDEvmNu/nLTG2mQAkvH88HbveO2u3EKUUoGZYrJE";
|
||
|
|
||
|
# downloadUrl = "https://upwork-usw2-desktopapp.upwork.com/binaries/v5_6_10_13_3c485d1dd2af4f61/${pname}_${version}_amd64.deb";
|
||
|
|
||
|
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||
|
|
||
|
nativeBuildInputs = [ wget ];
|
||
|
|
||
|
} ''
|
||
|
# mkdir -p $out
|
||
|
|
||
|
wget -U "Mozilla/5.0 (X11; Linux x86_64; rv:103.0)" "https://upwork-usw2-desktopapp.upwork.com/binaries/v5_6_10_13_3c485d1dd2af4f61/upwork_5.6.10.13_amd64.deb"
|
||
|
|
||
|
# curl -i \
|
||
|
# -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8" \
|
||
|
# -H "Accept-Encoding: gzip, deflate, br" \
|
||
|
# -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0" \
|
||
|
# -O https://upwork-usw2-desktopapp.upwork.com/binaries/v5_6_10_13_3c485d1dd2af4f61/upwork_5.6.10.13_amd64.deb
|
||
|
'';
|
||
|
|
||
|
nativeBuildInputs = [
|
||
|
dpkg
|
||
|
wrapGAppsHook
|
||
|
autoPatchelfHook
|
||
|
];
|
||
|
|
||
|
buildInputs = [
|
||
|
libcxx systemd libpulseaudio
|
||
|
stdenv.cc.cc alsa-lib atk at-spi2-atk at-spi2-core cairo cups
|
||
|
dbus expat fontconfig freetype gdk-pixbuf glib gtk3 libdrm libnotify
|
||
|
libuuid libX11 libxcb libXcomposite libXcursor libXdamage libXext libXfixes
|
||
|
libXi libXrandr libXrender libXScrnSaver libXtst mesa nspr nss pango systemd
|
||
|
];
|
||
|
|
||
|
libPath = lib.makeLibraryPath buildInputs;
|
||
|
|
||
|
dontWrapGApps = true;
|
||
|
dontBuild = true;
|
||
|
dontConfigure = true;
|
||
|
|
||
|
unpackPhase = ''
|
||
|
# curl -i -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0" -O https://upwork-usw2-desktopapp.upwork.com/binaries/v5_6_10_13_3c485d1dd2af4f61/upwork_5.6.10.13_amd64.deb
|
||
|
echo $out
|
||
|
echo $src
|
||
|
dpkg-deb -x "$src" ./
|
||
|
'';
|
||
|
|
||
|
installPhase = ''
|
||
|
runHook preInstall
|
||
|
mv usr $out
|
||
|
mv opt $out
|
||
|
# Now it requires lib{ssl,crypto}.so.1.0.0. Fix based on Spotify pkg.
|
||
|
# https://github.com/NixOS/nixpkgs/blob/efea022d6fe0da84aa6613d4ddeafb80de713457/pkgs/applications/audio/spotify/default.nix#L129
|
||
|
mkdir -p $out/lib/upwork
|
||
|
ln -s ${lib.getLib openssl}/lib/libssl.so $out/lib/upwork/libssl.so.1.0.0
|
||
|
ln -s ${lib.getLib openssl}/lib/libcrypto.so $out/lib/upwork/libcrypto.so.1.0.0
|
||
|
sed -e "s|/opt/Upwork|$out/bin|g" -i $out/share/applications/upwork.desktop
|
||
|
makeWrapper $out/opt/Upwork/upwork \
|
||
|
$out/bin/upwork \
|
||
|
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
|
||
|
--prefix LD_LIBRARY_PATH : ${libPath}
|
||
|
runHook postInstall
|
||
|
'';
|
||
|
|
||
|
meta = with lib; {
|
||
|
description = "Online freelancing platform desktop application for time tracking";
|
||
|
homepage = "https://www.upwork.com/ab/downloads/";
|
||
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||
|
license = licenses.unfree;
|
||
|
platforms = [ "x86_64-linux" ];
|
||
|
maintainers = with maintainers; [ zakkor wolfangaukang ];
|
||
|
};
|
||
|
}
|