2009-03-06 13:26:24 +01:00
|
|
|
{pkgs, config, ...}:
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption mkIf;
|
|
|
|
|
|
|
|
options = {
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
portNumber = mkOption {
|
|
|
|
default = 6667;
|
|
|
|
description = ''
|
|
|
|
Number of the port BitlBee will be listening to.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
2008-03-26 17:42:57 +01:00
|
|
|
|
|
|
|
let
|
2009-05-29 16:25:56 +02:00
|
|
|
bitlbeeUid = config.ids.uids.bitlbee;
|
2009-03-06 13:26:24 +01:00
|
|
|
inherit (config.services.bitlbee) portNumber interface;
|
2008-03-26 17:42:57 +01:00
|
|
|
in
|
2009-03-06 13:26:24 +01:00
|
|
|
|
|
|
|
mkIf config.services.bitlbee.enable {
|
|
|
|
|
2009-05-29 16:25:56 +02:00
|
|
|
require = options;
|
2008-03-26 17:42:57 +01:00
|
|
|
|
2009-03-06 13:26:24 +01:00
|
|
|
users = {
|
|
|
|
extraUsers = [
|
|
|
|
{ name = "bitlbee";
|
|
|
|
uid = bitlbeeUid;
|
|
|
|
description = "BitlBee user";
|
|
|
|
home = "/var/empty";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
extraGroups = [
|
|
|
|
{ name = "bitlbee";
|
2009-05-29 16:25:56 +02:00
|
|
|
gid = config.ids.gids.bitlbee;
|
2009-03-06 13:26:24 +01:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2009-05-29 16:25:56 +02:00
|
|
|
services.extraJobs = [{
|
|
|
|
name = "bitlbee";
|
2009-03-06 13:26:24 +01:00
|
|
|
|
2009-05-29 16:25:56 +02:00
|
|
|
job = ''
|
|
|
|
description "BitlBee IRC to other chat networks gateway"
|
2008-02-18 10:15:10 +01:00
|
|
|
|
2009-05-29 16:25:56 +02:00
|
|
|
start on network-interfaces/started
|
|
|
|
stop on network-interfaces/stop
|
2008-02-18 10:15:10 +01:00
|
|
|
|
2009-05-29 16:25:56 +02:00
|
|
|
start script
|
|
|
|
if ! test -d /var/lib/bitlbee
|
|
|
|
then
|
|
|
|
mkdir -p /var/lib/bitlbee
|
|
|
|
fi
|
|
|
|
end script
|
2008-02-18 10:15:10 +01:00
|
|
|
|
2009-05-29 16:25:56 +02:00
|
|
|
respawn ${pkgs.bitlbee}/sbin/bitlbee -F -p ${toString portNumber} \
|
|
|
|
-i ${interface} -u bitlbee
|
|
|
|
'';
|
|
|
|
}];
|
|
|
|
|
2009-06-30 10:01:14 +02:00
|
|
|
environment.systemPackages = [ pkgs.bitlbee ];
|
2008-02-18 10:15:10 +01:00
|
|
|
}
|