2009-10-12 18:36:19 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-03-06 13:26:24 +01:00
|
|
|
|
|
|
|
let
|
2009-10-12 18:36:19 +02:00
|
|
|
|
|
|
|
bitlbeeUid = config.ids.uids.bitlbee;
|
|
|
|
|
|
|
|
inherit (config.services.bitlbee) portNumber interface;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2009-03-06 13:26:24 +01:00
|
|
|
|
|
|
|
options = {
|
2009-10-12 18:36:19 +02:00
|
|
|
|
|
|
|
services.bitlbee = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to run the BitlBee IRC to other chat network gateway.
|
|
|
|
Running it allows you to access the MSN, Jabber, Yahoo! and ICQ chat
|
|
|
|
networks via an IRC client.
|
|
|
|
'';
|
|
|
|
};
|
2009-03-06 13:26:24 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
interface = mkOption {
|
|
|
|
default = "127.0.0.1";
|
|
|
|
description = ''
|
|
|
|
The interface the BitlBee deamon will be listening to. If `127.0.0.1',
|
|
|
|
only clients on the local host can connect to it; if `0.0.0.0', clients
|
|
|
|
can access it from any network interface.
|
|
|
|
'';
|
|
|
|
};
|
2009-03-06 13:26:24 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
portNumber = mkOption {
|
|
|
|
default = 6667;
|
|
|
|
description = ''
|
|
|
|
Number of the port BitlBee will be listening to.
|
|
|
|
'';
|
2009-03-06 13:26:24 +01:00
|
|
|
};
|
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
};
|
2008-03-26 17:42:57 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
};
|
|
|
|
|
2009-03-06 13:26:24 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
###### implementation
|
2009-03-06 13:26:24 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
config = mkIf config.services.bitlbee.enable {
|
2008-03-26 17:42:57 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
users.extraUsers = singleton
|
2009-03-06 13:26:24 +01:00
|
|
|
{ name = "bitlbee";
|
|
|
|
uid = bitlbeeUid;
|
|
|
|
description = "BitlBee user";
|
|
|
|
home = "/var/empty";
|
2009-10-12 18:36:19 +02:00
|
|
|
};
|
2009-03-06 13:26:24 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
users.extraGroups = singleton
|
2009-03-06 13:26:24 +01:00
|
|
|
{ name = "bitlbee";
|
2009-05-29 16:25:56 +02:00
|
|
|
gid = config.ids.gids.bitlbee;
|
2009-10-12 18:36:19 +02:00
|
|
|
};
|
2009-03-06 13:26:24 +01:00
|
|
|
|
2009-10-12 20:09:34 +02:00
|
|
|
jobs.bitlbee =
|
2009-10-12 18:36:19 +02:00
|
|
|
{ description = "BitlBee IRC to other chat networks gateway";
|
2008-02-18 10:15:10 +01:00
|
|
|
|
2009-12-15 14:02:23 +01:00
|
|
|
startOn = "ip-up";
|
2008-02-18 10:15:10 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
preStart =
|
|
|
|
''
|
|
|
|
if ! test -d /var/lib/bitlbee
|
|
|
|
then
|
|
|
|
mkdir -p /var/lib/bitlbee
|
|
|
|
chown bitlbee:bitlbee /var/lib/bitlbee
|
|
|
|
fi
|
|
|
|
'';
|
2008-02-18 10:15:10 +01:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
exec =
|
|
|
|
''
|
|
|
|
${pkgs.bitlbee}/sbin/bitlbee -F -p ${toString portNumber} \
|
2009-05-29 16:25:56 +02:00
|
|
|
-i ${interface} -u bitlbee
|
2009-10-12 18:36:19 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.bitlbee ];
|
2009-05-29 16:25:56 +02:00
|
|
|
|
2009-10-12 18:36:19 +02:00
|
|
|
};
|
|
|
|
|
2008-02-18 10:15:10 +01:00
|
|
|
}
|