lol

bitlbee service: Add option to load libpurple plugins into bitlbee

+24 -3
+24 -3
nixos/modules/services/networking/bitlbee.nix
··· 7 7 cfg = config.services.bitlbee; 8 8 bitlbeeUid = config.ids.uids.bitlbee; 9 9 10 + bitlbeePkg = if cfg.libpurple_plugins == [] 11 + then pkgs.bitlbee 12 + else pkgs.bitlbee.override { enableLibPurple = true; }; 13 + 10 14 bitlbeeConfig = pkgs.writeText "bitlbee.conf" 11 15 '' 12 16 [settings] ··· 24 28 [defaults] 25 29 ${cfg.extraDefaults} 26 30 ''; 31 + 32 + purple_plugin_path = 33 + lib.concatMapStringsSep ":" 34 + (plugin: "${plugin}/lib/pidgin/") 35 + cfg.libpurple_plugins 36 + ; 27 37 28 38 in 29 39 ··· 90 100 ''; 91 101 }; 92 102 103 + libpurple_plugins = mkOption { 104 + type = types.listOf types.package; 105 + default = []; 106 + example = literalExample "[ pkgs.purple-matrix ]"; 107 + description = '' 108 + The list of libpurple plugins to install. 109 + ''; 110 + }; 111 + 93 112 configDir = mkOption { 94 113 default = "/var/lib/bitlbee"; 95 114 type = types.path; ··· 144 163 }; 145 164 146 165 systemd.services.bitlbee = 147 - { description = "BitlBee IRC to other chat networks gateway"; 166 + { 167 + environment.PURPLE_PLUGIN_PATH = purple_plugin_path; 168 + description = "BitlBee IRC to other chat networks gateway"; 148 169 after = [ "network.target" ]; 149 170 wantedBy = [ "multi-user.target" ]; 150 171 serviceConfig.User = "bitlbee"; 151 - serviceConfig.ExecStart = "${pkgs.bitlbee}/sbin/bitlbee -F -n -c ${bitlbeeConfig}"; 172 + serviceConfig.ExecStart = "${bitlbeePkg}/sbin/bitlbee -F -n -c ${bitlbeeConfig}"; 152 173 }; 153 174 154 - environment.systemPackages = [ pkgs.bitlbee ]; 175 + environment.systemPackages = [ bitlbeePkg ]; 155 176 156 177 }; 157 178