@@ -0,0 +1,65 @@
1+{ stdenv, lib
2+, makeWrapper, dpkg, fetchurl, autoPatchelfHook
3+, curl, kerberos, lttng-ust, libpulseaudio, gtk3, openssl_1_1, icu, webkitgtk, librsvg, gdk-pixbuf, libsoup, glib-networking
4+}:
5+
6+stdenv.mkDerivation rec {
7+ pname = "aws-workspaces";
8+ version = "3.1.3.925";
9+
10+ src = fetchurl {
11+ # ref https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu/dists/bionic/main/binary-amd64/Packages
12+ urls = [
13+ "https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu/dists/bionic/main/binary-amd64/workspacesclient_${version}_amd64.deb"
14+ "https://web.archive.org/web/20210307233836/https://d3nt0h4h6pmmc4.cloudfront.net/ubuntu/dists/bionic/main/binary-amd64/workspacesclient_${version}_amd64.deb"
15+ ];
16+ sha256 = "5b57edb4f6f8c950164fd8104bf62df4c452ab5b16cb65d48db3636959a0f0ad";
17+ };
18+
19+ nativeBuildInputs = [
20+ autoPatchelfHook
21+ makeWrapper
22+ ];
23+
24+ # Crashes at startup when stripping:
25+ # "Failed to create CoreCLR, HRESULT: 0x80004005"
26+ dontStrip = true;
27+
28+ buildInputs = [
29+ stdenv.cc.cc.lib
30+ kerberos
31+ curl
32+ lttng-ust
33+ libpulseaudio
34+ gtk3
35+ openssl_1_1.out
36+ icu
37+ webkitgtk
38+ librsvg
39+ gdk-pixbuf
40+ libsoup
41+ glib-networking
42+ ];
43+
44+ unpackPhase = ''
45+ ${dpkg}/bin/dpkg -x $src $out
46+ '';
47+
48+ installPhase = ''
49+ mkdir -p $out/bin
50+ mv $out/opt/workspacesclient/* $out/bin
51+
52+ wrapProgram $out/bin/workspacesclient \
53+ --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath buildInputs}" \
54+ --set GDK_PIXBUF_MODULE_FILE "${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" \
55+ --set GIO_EXTRA_MODULES "${glib-networking.out}/lib/gio/modules"
56+ '';
57+
58+ meta = with lib; {
59+ description = "Client for Amazon WorkSpaces, a managed, secure Desktop-as-a-Service (DaaS) solution";
60+ homepage = "https://clients.amazonworkspaces.com";
61+ license = licenses.unfree;
62+ platforms = [ "x86_64-linux" ]; # TODO Mac support
63+ maintainers = [ maintainers.mausch ];
64+ };
65+}