summary refs log tree commit diff
path: root/nixos/modules/services/networking
diff options
context:
space:
mode:
authorNadrieril <nadrieril@gmail.com>2017-07-02 19:06:44 +0100
committerNadrieril <nadrieril@gmail.com>2017-07-16 14:19:39 +0100
commit65e38b7c52976007a2bed5d6b971073cdb9f5bbd (patch)
treedabb4b72e5b74426e0b0704b79118aee2f84159d /nixos/modules/services/networking
parentce6fe1a61be52e6cb6d0d0f11ec917d31a93a7b7 (diff)
downloadnixlib-65e38b7c52976007a2bed5d6b971073cdb9f5bbd.tar
nixlib-65e38b7c52976007a2bed5d6b971073cdb9f5bbd.tar.gz
nixlib-65e38b7c52976007a2bed5d6b971073cdb9f5bbd.tar.bz2
nixlib-65e38b7c52976007a2bed5d6b971073cdb9f5bbd.tar.lz
nixlib-65e38b7c52976007a2bed5d6b971073cdb9f5bbd.tar.xz
nixlib-65e38b7c52976007a2bed5d6b971073cdb9f5bbd.tar.zst
nixlib-65e38b7c52976007a2bed5d6b971073cdb9f5bbd.zip
bitlbee service: Add option to load libpurple plugins into bitlbee
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r--nixos/modules/services/networking/bitlbee.nix27
1 files changed, 24 insertions, 3 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 ];
 
   };