1{
2 lib,
3 stdenv,
4 requireFile,
5 dpkg,
6 wrapGAppsHook3,
7 autoPatchelfHook,
8 alsa-lib,
9 atk,
10 at-spi2-atk,
11 at-spi2-core,
12 cairo,
13 cups,
14 dbus,
15 expat,
16 fontconfig,
17 freetype,
18 gdk-pixbuf,
19 glib,
20 gtk3,
21 libcxx,
22 libdrm,
23 libnotify,
24 libpulseaudio,
25 libuuid,
26 libX11,
27 libxcb,
28 libXcomposite,
29 libXcursor,
30 libXdamage,
31 libXext,
32 libXfixes,
33 libXi,
34 libXrandr,
35 libXrender,
36 libXScrnSaver,
37 libXtst,
38 libgbm,
39 nspr,
40 nss,
41 openssl,
42 pango,
43 systemd,
44}:
45
46stdenv.mkDerivation rec {
47 pname = "upwork";
48 version = "5.8.0.35";
49
50 src = requireFile {
51 name = "${pname}_${version}_amd64.deb";
52 url = "https://www.upwork.com/ab/downloads/os/linux/";
53 sha256 = "sha256-Suv23TL6l5HhkOSRT56LpFRZJxuSLYVc1uT6he8j7O0=";
54 };
55
56 nativeBuildInputs = [
57 dpkg
58 wrapGAppsHook3
59 autoPatchelfHook
60 ];
61
62 buildInputs = [
63 libcxx
64 systemd
65 libpulseaudio
66 stdenv.cc.cc
67 alsa-lib
68 atk
69 at-spi2-atk
70 at-spi2-core
71 cairo
72 cups
73 dbus
74 expat
75 fontconfig
76 freetype
77 gdk-pixbuf
78 glib
79 gtk3
80 libdrm
81 libnotify
82 libuuid
83 libX11
84 libxcb
85 libXcomposite
86 libXcursor
87 libXdamage
88 libXext
89 libXfixes
90 libXi
91 libXrandr
92 libXrender
93 libXScrnSaver
94 libXtst
95 libgbm
96 nspr
97 nss
98 pango
99 systemd
100 ];
101
102 libPath = lib.makeLibraryPath buildInputs;
103
104 dontWrapGApps = true;
105
106 installPhase = ''
107 runHook preInstall
108
109 mv usr $out
110 mv opt $out
111
112 # Now it requires lib{ssl,crypto}.so.1.0.0. Fix based on Spotify pkg.
113 # https://github.com/NixOS/nixpkgs/blob/efea022d6fe0da84aa6613d4ddeafb80de713457/pkgs/applications/audio/spotify/default.nix#L129
114 mkdir -p $out/lib/upwork
115 ln -s ${lib.getLib openssl}/lib/libssl.so $out/lib/upwork/libssl.so.1.0.0
116 ln -s ${lib.getLib openssl}/lib/libcrypto.so $out/lib/upwork/libcrypto.so.1.0.0
117
118 sed -e "s|/opt/Upwork|$out/bin|g" -i $out/share/applications/upwork.desktop
119 makeWrapper $out/opt/Upwork/upwork \
120 $out/bin/upwork \
121 --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
122 --prefix LD_LIBRARY_PATH : ${libPath}
123
124 runHook postInstall
125 '';
126
127 meta = with lib; {
128 description = "Online freelancing platform desktop application for time tracking";
129 homepage = "https://www.upwork.com/ab/downloads/";
130 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
131 license = licenses.unfree;
132 platforms = [ "x86_64-linux" ];
133 maintainers = with maintainers; [ zakkor ];
134 };
135}