summary refs log tree commit diff
path: root/pkgs/applications/networking/aether/default.nix
blob: 62dbae082d9a1e6752ead12bf0f6fa22e7ca2971 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{ autoPatchelfHook, makeDesktopItem, lib, stdenv, wrapGAppsHook
, alsa-lib, at-spi2-atk, at-spi2-core, atk, cairo, cups, dbus, expat, fontconfig
, freetype, gdk-pixbuf, glib, gtk3, libcxx, libdrm, libnotify, libpulseaudio, libuuid
, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence
, mesa, nspr, nss, pango, systemd, libappindicator-gtk3, libdbusmenu
, fetchurl, fetchFromGitHub, imagemagick, copyDesktopItems
}:

let
  binaryName = "AetherP2P";
  aether-app-git = fetchFromGitHub {
    owner = "aethereans";
    repo = "aether-app";
    rev = "53b6c8b2a9253cbf056ea3ebb077e0e08cbc5b1d";
    sha256 = "1kgkzh7ih2q9dsckdkinh5dbzvr7gdykf8yz6h8pyhvzyjhk1v0r";
  };
in
stdenv.mkDerivation rec {
  pname = "aether";
  version = "2.0.0-dev.15";

  src = fetchurl {
    url = "https://static.getaether.net/Releases/Aether-${version}/2011262249.19338c93/linux/Aether-${version}%2B2011262249.19338c93.tar.gz";
    sha256 = "1hi8w83zal3ciyzg2m62shkbyh6hj7gwsidg3dn88mhfy68himf7";
    # % in the url / canonical filename causes an error
    name = "aether-tarball.tar.gz";
  };

  # there is no logo in the tarball so we grab it from github and convert it in the build phase
  buildPhase = ''
    convert ${aether-app-git}/aether-core/aether/client/src/app/ext_dep/images/Linux-Windows-App-Icon.png -resize 512x512 aether.png
  '';

  dontWrapGApps = true;

  buildInputs = [
    alsa-lib
    cups
    libdrm
    libuuid
    libXdamage
    libX11
    libXScrnSaver
    libXtst
    libxcb
    libxshmfence
    mesa
    nss
  ];

  nativeBuildInputs = [
    imagemagick
    autoPatchelfHook
    wrapGAppsHook
    copyDesktopItems
  ];

  desktopItems = [
    (makeDesktopItem {
      name = pname;
      exec = binaryName;
      icon = pname;
      desktopName = "Aether";
      genericName = meta.description;
      categories = [ "Network" ];
      mimeTypes = [ "x-scheme-handler/aether" ];
    })
  ];

  installPhase =
  let
    libPath = lib.makeLibraryPath [
      libcxx systemd libpulseaudio libdrm mesa
      stdenv.cc.cc alsa-lib atk at-spi2-atk at-spi2-core cairo cups dbus expat fontconfig freetype
      gdk-pixbuf glib gtk3 libnotify libX11 libXcomposite libuuid
      libXcursor libXdamage libXext libXfixes libXi libXrandr libXrender
      libXtst nspr nss libxcb pango systemd libXScrnSaver
      libappindicator-gtk3 libdbusmenu
    ];
  in
  ''
    mkdir -p $out/{bin,opt/${binaryName},share/icons/hicolor/512x512/apps}
    mv * $out/opt/${binaryName}

    chmod +x $out/opt/${binaryName}/${binaryName}
    patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
        $out/opt/${binaryName}/${binaryName}

    wrapProgram $out/opt/${binaryName}/${binaryName} \
        "''${gappsWrapperArgs[@]}" \
        --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}" \
        --prefix LD_LIBRARY_PATH : ${libPath}

    ln -s $out/opt/${binaryName}/${binaryName} $out/bin/

    ln -s $out/opt/${binaryName}/aether.png $out/share/icons/hicolor/512x512/apps/

    runHook postInstall
  '';

  meta = with lib; {
    description = "Peer-to-peer ephemeral public communities";
    homepage = "https://getaether.net/";
    downloadPage = "https://getaether.net/download/";
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    license = licenses.agpl3Only;
    maintainers = with maintainers; [ maxhille ];
    # other platforms could be supported by building from source
    platforms = [ "x86_64-linux" ];
  };
}