summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-07-17 18:07:43 +0100
committerGitHub <noreply@github.com>2017-07-17 18:07:43 +0100
commit04c944cdb4ecd0a315b192e3ec188938076b7d00 (patch)
treea256373e28240ef2b06c15b81a7578017e5cdc55
parentb8d92a7840dd1bb377f83df9aae651624187ebf0 (diff)
parent65e38b7c52976007a2bed5d6b971073cdb9f5bbd (diff)
downloadnixlib-04c944cdb4ecd0a315b192e3ec188938076b7d00.tar
nixlib-04c944cdb4ecd0a315b192e3ec188938076b7d00.tar.gz
nixlib-04c944cdb4ecd0a315b192e3ec188938076b7d00.tar.bz2
nixlib-04c944cdb4ecd0a315b192e3ec188938076b7d00.tar.lz
nixlib-04c944cdb4ecd0a315b192e3ec188938076b7d00.tar.xz
nixlib-04c944cdb4ecd0a315b192e3ec188938076b7d00.tar.zst
nixlib-04c944cdb4ecd0a315b192e3ec188938076b7d00.zip
Merge pull request #27057 from Nadrieril/bitlbee-libpurple
bitlbee service: Add option to load libpurple plugins into bitlbee
-rw-r--r--nixos/modules/services/networking/bitlbee.nix27
-rw-r--r--pkgs/applications/networking/instant-messengers/bitlbee/default.nix16
2 files changed, 35 insertions, 8 deletions
diff --git a/nixos/modules/services/networking/bitlbee.nix b/nixos/modules/services/networking/bitlbee.nix
index e72ea20cccee..bd26804788f3 100644
--- a/nixos/modules/services/networking/bitlbee.nix
+++ b/nixos/modules/services/networking/bitlbee.nix
@@ -7,6 +7,10 @@ let
   cfg = config.services.bitlbee;
   bitlbeeUid = config.ids.uids.bitlbee;
 
+  bitlbeePkg = if cfg.libpurple_plugins == []
+  then pkgs.bitlbee
+  else pkgs.bitlbee.override { enableLibPurple = true; };
+
   bitlbeeConfig = pkgs.writeText "bitlbee.conf"
     ''
     [settings]
@@ -25,6 +29,12 @@ let
     ${cfg.extraDefaults}
     '';
 
+  purple_plugin_path =
+    lib.concatMapStringsSep ":"
+      (plugin: "${plugin}/lib/pidgin/")
+      cfg.libpurple_plugins
+    ;
+
 in
 
 {
@@ -90,6 +100,15 @@ in
         '';
       };
 
+      libpurple_plugins = mkOption {
+        type = types.listOf types.package;
+        default = [];
+        example = literalExample "[ pkgs.purple-matrix ]";
+        description = ''
+          The list of libpurple plugins to install.
+        '';
+      };
+
       configDir = mkOption {
         default = "/var/lib/bitlbee";
         type = types.path;
@@ -144,14 +163,16 @@ in
       };
 
     systemd.services.bitlbee =
-      { description = "BitlBee IRC to other chat networks gateway";
+      {
+        environment.PURPLE_PLUGIN_PATH = purple_plugin_path;
+        description = "BitlBee IRC to other chat networks gateway";
         after = [ "network.target" ];
         wantedBy = [ "multi-user.target" ];
         serviceConfig.User = "bitlbee";
-        serviceConfig.ExecStart = "${pkgs.bitlbee}/sbin/bitlbee -F -n -c ${bitlbeeConfig}";
+        serviceConfig.ExecStart = "${bitlbeePkg}/sbin/bitlbee -F -n -c ${bitlbeeConfig}";
       };
 
-    environment.systemPackages = [ pkgs.bitlbee ];
+    environment.systemPackages = [ bitlbeePkg ];
 
   };
 
diff --git a/pkgs/applications/networking/instant-messengers/bitlbee/default.nix b/pkgs/applications/networking/instant-messengers/bitlbee/default.nix
index 5ee93bd4df5b..abb0a1172973 100644
--- a/pkgs/applications/networking/instant-messengers/bitlbee/default.nix
+++ b/pkgs/applications/networking/instant-messengers/bitlbee/default.nix
@@ -1,4 +1,5 @@
-{ fetchurl, fetchpatch, stdenv, gnutls, glib, pkgconfig, check, libotr, python }:
+{ fetchurl, fetchpatch, stdenv, gnutls, glib, pkgconfig, check, libotr, python,
+enableLibPurple ? false, pidgin ? null }:
 
 with stdenv.lib;
 stdenv.mkDerivation rec {
@@ -11,20 +12,25 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ] ++ optional doCheck check;
 
-  buildInputs = [ gnutls glib libotr python ];
+  buildInputs = [ gnutls glib libotr python ]
+    ++ optional enableLibPurple pidgin;
+
+  preConfigure = optionalString enableLibPurple
+    "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${pidgin}/lib/pkgconfig";
 
   configureFlags = [
     "--gcov=1"
     "--otr=1"
     "--ssl=gnutls"
     "--pidfile=/var/lib/bitlbee/bitlbee.pid"
-  ];
+  ]
+  ++ optional enableLibPurple "--purple=1";
 
-  buildPhase = ''
+  buildPhase = optionalString (!enableLibPurple) ''
     make install-dev
   '';
 
-  doCheck = true;
+  doCheck = !enableLibPurple; # Checks fail with libpurple for some reason
 
   meta = {
     description = "IRC instant messaging gateway";