about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix
blob: 879314a97f0e0bf6b6b57d743ac38a6af388aa4b (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
{ lib, stdenv, fetchFromGitHub
, buildPackages
, vala, cmake, ninja, wrapGAppsHook, pkg-config, gettext
, gobject-introspection, glib, gdk-pixbuf, gtk4, glib-networking
, libadwaita
, libnotify, libsoup, libgee
, libsignal-protocol-c
, libgcrypt
, sqlite
, gpgme
, pcre2
, qrencode
, icu
, gspell
, srtp
, libnice
, gnutls
, gstreamer
, gst-plugins-base
, gst-plugins-good
, gst-plugins-bad
, gst-vaapi
, webrtc-audio-processing
}:

stdenv.mkDerivation rec {
  pname = "dino";
  version = "0.4.3";

  src = fetchFromGitHub {
    owner = "dino";
    repo = "dino";
    rev = "v${version}";
    sha256 = "sha256-smy/t6wTCnG0kuRFKwyeLENKqOQDhL0fZTtj3BHo6kw=";
  };

  postPatch = ''
    # don't overwrite manually set version information
    substituteInPlace CMakeLists.txt \
      --replace "include(ComputeVersion)" ""
  '';

  nativeBuildInputs = [
    vala
    cmake
    ninja # https://github.com/dino/dino/issues/230
    pkg-config
    wrapGAppsHook
    gettext
    gobject-introspection
  ];

  buildInputs = [
    qrencode
    glib
    glib-networking # required for TLS support
    libadwaita
    libgee
    sqlite
    gdk-pixbuf
    gtk4
    libnotify
    gpgme
    libgcrypt
    libsoup
    pcre2
    icu
    libsignal-protocol-c
    gspell
    srtp
    libnice
    gnutls
    gstreamer
    gst-plugins-base
    gst-plugins-good # contains rtpbin, required for VP9
    gst-plugins-bad # required for H264, MSDK
    gst-vaapi # required for VAAPI
    webrtc-audio-processing
  ];

  cmakeFlags = [
    "-DBUILD_TESTS=true"
    "-DRTP_ENABLE_H264=true"
    "-DRTP_ENABLE_MSDK=true"
    "-DRTP_ENABLE_VAAPI=true"
    "-DRTP_ENABLE_VP9=true"
    "-DVERSION_FOUND=true"
    "-DVERSION_IS_RELEASE=true"
    "-DVERSION_FULL=${version}"
    "-DXGETTEXT_EXECUTABLE=${lib.getBin buildPackages.gettext}/bin/xgettext"
    "-DMSGFMT_EXECUTABLE=${lib.getBin buildPackages.gettext}/bin/msgfmt"
    "-DGLIB_COMPILE_RESOURCES_EXECUTABLE=${lib.getDev buildPackages.glib}/bin/glib-compile-resources"
    "-DSOUP_VERSION=${lib.versions.major libsoup.version}"
  ];

  # Undefined symbols for architecture arm64: "_gpg_strerror"
  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lgpg-error";

  doCheck = true;
  checkPhase = ''
    runHook preCheck
    ./xmpp-vala-test
    ./signal-protocol-vala-test
    runHook postCheck
  '';

  # Dino looks for plugins with a .so filename extension, even on macOS where
  # .dylib is appropriate, and despite the fact that it builds said plugins with
  # that as their filename extension
  #
  # Therefore, on macOS rename all of the plugins to use correct names that Dino
  # will load
  #
  # See https://github.com/dino/dino/wiki/macOS
  postFixup = lib.optionalString (stdenv.isDarwin) ''
    cd "$out/lib/dino/plugins/"
    for f in *.dylib; do
      mv "$f" "$(basename "$f" .dylib).so"
    done
  '';

  meta = with lib; {
    description = "Modern Jabber/XMPP Client using GTK/Vala";
    homepage = "https://github.com/dino/dino";
    license = licenses.gpl3Plus;
    platforms = platforms.linux ++ platforms.darwin;
    maintainers = with maintainers; [ qyliss tomfitzhenry ];
  };
}