@@ -0,0 +1,115 @@
1+{ autoPatchelfHook, makeDesktopItem, lib, stdenv, wrapGAppsHook
2+, alsa-lib, at-spi2-atk, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig
3+, freetype, gdk-pixbuf, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid
4+, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
5+, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence
6+, mesa, nspr, nss, pango, systemd, libappindicator-gtk3, libdbusmenu
7+, fetchurl, fetchFromGitHub, imagemagick, copyDesktopItems
8+}:
9+
10+let
11+ binaryName = "AetherP2P";
12+in
13+stdenv.mkDerivation rec {
14+ pname = "aether";
15+ version = "2.0.0-dev.15";
16+
17+ srcs = [
18+ (fetchurl {
19+ url = "https://static.getaether.net/Releases/Aether-${version}/2011262249.19338c93/linux/Aether-${version}%2B2011262249.19338c93.tar.gz";
20+ sha256 = "1hi8w83zal3ciyzg2m62shkbyh6hj7gwsidg3dn88mhfy68himf7";
21+ # % in the url / canonical filename causes an error
22+ name = "aether-tarball.tar.gz";
23+ })
24+ (fetchFromGitHub {
25+ owner = "aethereans";
26+ repo = "aether-app";
27+ rev = "53b6c8b2a9253cbf056ea3ebb077e0e08cbc5b1d";
28+ sha256 = "1kgkzh7ih2q9dsckdkinh5dbzvr7gdykf8yz6h8pyhvzyjhk1v0r";
29+ })
30+ ];
31+
32+ sourceRoot = "Aether-${version}+2011262249.19338c93";
33+
34+ # there is no logo in the tarball so we grab it from github and convert it in the build phase
35+ buildPhase = ''
36+ convert ../source/aether-core/aether/client/src/app/ext_dep/images/Linux-Windows-App-Icon.png -resize 512x512 aether.png
37+ '';
38+
39+ dontWrapGApps = true;
40+
41+ buildInputs = [
42+ alsa-lib
43+ cups
44+ libdrm
45+ libuuid
46+ libXdamage
47+ libX11
48+ libXScrnSaver
49+ libXtst
50+ libxcb
51+ libxshmfence
52+ mesa
53+ nss
54+ ];
55+
56+ nativeBuildInputs = [
57+ imagemagick
58+ autoPatchelfHook
59+ wrapGAppsHook
60+ copyDesktopItems
61+ ];
62+
63+ desktopItems = [
64+ (makeDesktopItem {
65+ name = pname;
66+ exec = binaryName;
67+ icon = pname;
68+ desktopName = "Aether";
69+ genericName = meta.description;
70+ categories = "Network;";
71+ mimeType = "x-scheme-handler/aether";
72+ })
73+ ];
74+
75+ installPhase =
76+ let
77+ libPath = lib.makeLibraryPath [
78+ libcxx systemd libpulseaudio libdrm mesa
79+ stdenv.cc.cc alsa-lib atk at-spi2-atk at-spi2-core cairo cups dbus expat fontconfig freetype
80+ gdk-pixbuf glib gtk3 libnotify libX11 libXcomposite libuuid
81+ libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
82+ libXtst nspr nss libxcb pango systemd libXScrnSaver
83+ libappindicator-gtk3 libdbusmenu
84+ ];
85+ in
86+ ''
87+ mkdir -p $out/{bin,opt/${binaryName},share/icons/hicolor/512x512/apps}
88+ mv * $out/opt/${binaryName}
89+
90+ chmod +x $out/opt/${binaryName}/${binaryName}
91+ patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
92+ $out/opt/${binaryName}/${binaryName}
93+
94+ wrapProgram $out/opt/${binaryName}/${binaryName} \
95+ "''${gappsWrapperArgs[@]}" \
96+ --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}" \
97+ --prefix LD_LIBRARY_PATH : ${libPath}
98+
99+ ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
100+
101+ ln -s $out/opt/${binaryName}/aether.png $out/share/icons/hicolor/512x512/apps/
102+
103+ runHook postInstall
104+ '';
105+
106+ meta = with lib; {
107+ description = "Peer-to-peer ephemeral public communities";
108+ homepage = "https://getaether.net/";
109+ downloadPage = "https://getaether.net/download/";
110+ license = licenses.agpl3Only;
111+ maintainers = with maintainers; [ maxhille ];
112+ # other platforms could be supported by building from source
113+ platforms = [ "x86_64-linux" ];
114+ };
115+}