about summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/fluffychat/default.nix
blob: 7064a32365e127681ce4f1039ddf0579f1f9f088 (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
{ lib
, stdenv
, fetchzip
, imagemagick
, autoPatchelfHook
, gtk3
, libsecret
, jsoncpp
, wrapGAppsHook
, makeDesktopItem
, openssl
, olm
}:

let
  # map of nix platform -> expected url platform
  platformMap = {
    x86_64-linux = "linux-x86";
    aarch64-linux = "linux-arm64";
  };
in
stdenv.mkDerivation rec {
  version = "1.10.0";
  name = "fluffychat";

  src = fetchzip {
    url = "https://gitlab.com/api/v4/projects/16112282/packages/generic/fluffychat/${version}/fluffychat-${platformMap.${stdenv.hostPlatform.system}}.tar.gz";
    stripRoot = false;
    sha256 = "sha256-SbzTEMeJRFEUN0nZF9hL0UEzTWl1VtHVPIx/AGgQvM8=";
  };

  desktopItem = makeDesktopItem {
    name = "Fluffychat";
    exec = "@out@/bin/fluffychat";
    icon = "fluffychat";
    desktopName = "Fluffychat";
    genericName = "Chat with your friends (matrix client)";
    categories = [ "Chat" "Network" "InstantMessaging" ];
  };
  buildInputs = [ gtk3 libsecret jsoncpp ];
  nativeBuildInputs = [ autoPatchelfHook wrapGAppsHook imagemagick ];

  installPhase = ''
    mkdir -p $out/bin
    mkdir -p $out/share
    mv * $out/share

    makeWrapper "$out/share/fluffychat" "$out/bin/fluffychat" \
      --prefix "LD_LIBRARY_PATH" ":" "${lib.makeLibraryPath [ openssl olm ]}"

    FAV=$out/share/data/flutter_assets/assets/favicon.png
    ICO=$out/share/icons

    install -D $FAV $ICO/fluffychat.png
    mkdir $out/share/applications
    cp $desktopItem/share/applications/*.desktop $out/share/applications
    for size in 24 32 42 64 128 256 512; do
      D=$ICO/hicolor/''${s}x''${s}/apps
      mkdir -p $D
      convert $FAV -resize ''${size}x''${size} $D/fluffychat.png
    done
    substituteInPlace $out/share/applications/*.desktop \
      --subst-var out
  '';

  meta = with lib; {
    description = "Chat with your friends (matrix client)";
    homepage = "https://fluffychat.im/";
    license = licenses.agpl3Plus;
    maintainers = with maintainers; [ mkg20001 gilice ];
    platforms = [ "x86_64-linux" "aarch64-linux" ];
    sourceProvenance = [ sourceTypes.binaryNativeCode ];
  };
}