about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/rambox/default.nix
blob: a067259d1127484da8ad9cd5d34a7522f2c13c49 (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
{ stdenv, lib, fetchurl, xdg_utils, dpkg, makeWrapper, autoPatchelfHook
, libXtst, libXScrnSaver, gtk3, nss, alsaLib, udev, libnotify, wrapGAppsHook
}:

let
  version = "0.7.6";
in stdenv.mkDerivation rec {
  pname = "rambox";
  inherit version;
  src = {
    x86_64-linux = fetchurl {
      url = "https://github.com/ramboxapp/community-edition/releases/download/${version}/Rambox-${version}-linux-amd64.deb";
      sha256 = "1v9l5nfd25mq448457hg0mj5bzylh0krk411kbr73s7lbaaww1jl";
    };
    i686-linux = fetchurl {
      url = "https://github.com/ramboxapp/community-edition/releases/download/${version}/Rambox-${version}-linux-i386.deb";
      sha256 = "0zhn5hnpl6fpgshp1vwghq6f1hz3f7gds7rjnhky1352cb6cr89i";
    };
  }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");

  nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook wrapGAppsHook ];
  buildInputs = [ libXtst libXScrnSaver gtk3 nss alsaLib ];
  runtimeDependencies = [ (lib.getLib udev) libnotify ];

  unpackPhase = "dpkg-deb -x $src .";

  installPhase = ''
    mkdir -p $out/bin
    cp -r opt $out
    ln -s $out/opt/Rambox/rambox $out/bin

    # provide resources
    cp -r usr/share $out
    substituteInPlace $out/share/applications/rambox.desktop \
      --replace Exec=/opt/Rambox/rambox Exec=rambox
  '';

  preFixup = ''
    gappsWrapperArgs+=(
      --prefix PATH : ${xdg_utils}/bin
    )
  '';

  meta = with stdenv.lib; {
    description = "Free and Open Source messaging and emailing app that combines common web applications into one";
    homepage = "https://rambox.pro";
    license = licenses.mit;
    maintainers = with maintainers; [ gnidorah ma27 ];
    platforms = ["i686-linux" "x86_64-linux"];
    hydraPlatforms = [];
  };
}