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