summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/profanity/default.nix
blob: 9d8a0d68e756f6bdcbe1e757587b195a45b866a1 (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
{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, glib, openssl
, glibcLocales, expect, ncurses, libotr, curl, readline, libuuid
, cmocka, libmicrohttpd, expat, sqlite, libmesode, autoconf-archive

, autoAwaySupport ? true,       libXScrnSaver ? null, libX11 ? null
, notifySupport ? true,         libnotify ? null, gdk-pixbuf ? null
, traySupport ? true,           gtk2 ? null
, pgpSupport ? true,            gpgme ? null
, pythonPluginSupport ? true,   python ? null
, omemoSupport ? true,          libsignal-protocol-c ? null, libgcrypt ? null
}:

assert autoAwaySupport     -> libXScrnSaver != null && libX11 != null;
assert notifySupport       -> libnotify != null && gdk-pixbuf != null;
assert traySupport         -> gtk2 != null;
assert pgpSupport          -> gpgme != null;
assert pythonPluginSupport -> python != null;
assert omemoSupport        -> libsignal-protocol-c != null && libgcrypt != null;

with lib;

stdenv.mkDerivation rec {
  pname = "profanity";
  version = "0.11.0";

  src = fetchFromGitHub {
    owner = "profanity-im";
    repo = "profanity";
    rev = version;
    sha256 = "0xmzsh0szm8x3hgw65j0cd2bp8cmrnq5pjz49lqajircyzflsngm";
  };

  patches = [
    ./patches/packages-osx.patch
  ];

  enableParallelBuilding = true;

  nativeBuildInputs = [
    autoreconfHook autoconf-archive glibcLocales pkg-config
  ];

  buildInputs = [
    expect readline libuuid glib openssl expat ncurses libotr
    curl libmesode cmocka libmicrohttpd sqlite
  ] ++ optionals autoAwaySupport     [ libXScrnSaver libX11 ]
    ++ optionals notifySupport       [ libnotify gdk-pixbuf ]
    ++ optionals traySupport         [ gtk2 ]
    ++ optionals pgpSupport          [ gpgme ]
    ++ optionals pythonPluginSupport [ python ]
    ++ optionals omemoSupport        [ libsignal-protocol-c libgcrypt ];

  # Enable feature flags, so that build fail if libs are missing
  configureFlags = [ "--enable-c-plugins" "--enable-otr" ]
    ++ optionals notifySupport       [ "--enable-notifications" ]
    ++ optionals traySupport         [ "--enable-icons-and-clipboard" ]
    ++ optionals pgpSupport          [ "--enable-pgp" ]
    ++ optionals pythonPluginSupport [ "--enable-python-plugins" ]
    ++ optionals omemoSupport        [ "--enable-omemo" ];

  preAutoreconf = ''
    mkdir m4
  '';

  doCheck = true;

  LC_ALL = "en_US.utf8";

  meta = {
    description = "A console based XMPP client";
    longDescription = ''
      Profanity is a console based XMPP client written in C using ncurses and
      libstrophe, inspired by Irssi.
    '';
    homepage = "http://www.profanity.im/";
    license = licenses.gpl3Plus;
    platforms = platforms.unix;
    changelog = "https://github.com/profanity-im/profanity/releases/tag/${version}";
    downloadPage = "https://github.com/profanity-im/profanity/releases/";
    maintainers = [ maintainers.devhell ];
    updateWalker = true;
  };
}