summary refs log tree commit diff
path: root/pkgs/applications/networking/instant-messengers/profanity/default.nix
blob: 42671f5d974b433cc9f96073aaac1db3b0d1ef2b (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
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, autoconf-archive
, autoreconfHook
, cmocka
, curl
, expat
, expect
, glib
, glibcLocales
, libmesode
, libmicrohttpd
, libotr
, libuuid
, ncurses
, openssl
, pkg-config
, readline
, sqlite
, autoAwaySupport ? true,       libXScrnSaver ? null, libX11
, notifySupport ? true,         libnotify, gdk-pixbuf
, omemoSupport ? true,          libsignal-protocol-c, libgcrypt
, pgpSupport ? true,            gpgme
, pythonPluginSupport ? true,   python
, traySupport ? true,           gtk
}:

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

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

  src = fetchFromGitHub {
    owner = "profanity-im";
    repo = "profanity";
    rev = version;
    hash = "sha256-8WGHOy0fSW8o7vMCYZqqpvDsn81JZefM6wGfjQ5iKbU=";
  };

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

    # pullupstream fixes for ncurses-6.3
    (fetchpatch {
      name = "ncurses-6.3-p1.patch";
      url = "https://github.com/profanity-im/profanity/commit/e5b6258c997d4faf36e2ffb8a47b386c5629b4eb.patch";
      sha256 = "sha256-4rwpvsgfIQ60GcLS0O7Hyn7ZidREjYT+dVND54z0zrw=";
    })
    (fetchpatch {
      name = "ncurses-6.3-p2.patch";
      url = "https://github.com/profanity-im/profanity/commit/fd9ccec8dc604902bbb1d444dba4223ccee0a092.patch";
      sha256 = "sha256-4gZaXoDNulBIR+e6y/9bJKXVactCHWS8H8lPJaJwVwE=";
    })
    (fetchpatch {
      name = "ncurses-6.3-p3.patch";
      url = "https://github.com/profanity-im/profanity/commit/242696f09a49c8446ba6aef8bdad65fb58a77715.patch";
      sha256 = "sha256-BOYHkae9aIA7HaVM23Yu25TTK9e3SuV+u0FEi7Sn62I=";
    })
  ];

  enableParallelBuilding = true;

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

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

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

  preAutoreconf = ''
    mkdir m4
  '';

  doCheck = true;

  LC_ALL = "en_US.utf8";

  meta =  with lib; {
    homepage = "http://www.profanity.im/";
    description = "A console based XMPP client";
    longDescription = ''
      Profanity is a console based XMPP client written in C using ncurses and
      libstrophe, inspired by Irssi.
    '';
    license = licenses.gpl3Plus;
    maintainers = [ maintainers.devhell ];
    platforms = platforms.unix;
  };
}