blob: 573feda546223260f9a43689781d891a3766345a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
{ config, pkgs, ... }:
with pkgs.lib;
let
bitlbeeUid = config.ids.uids.bitlbee;
inherit (config.services.bitlbee) portNumber interface;
in
{
###### interface
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.
'';
};
};
};
###### implementation
config = mkIf config.services.bitlbee.enable {
users.extraUsers = singleton
{ name = "bitlbee";
uid = bitlbeeUid;
description = "BitlBee user";
home = "/var/empty";
};
users.extraGroups = singleton
{ name = "bitlbee";
gid = config.ids.gids.bitlbee;
};
jobs.bitlbee =
{ description = "BitlBee IRC to other chat networks gateway";
startOn = "ip-up";
preStart =
''
if ! test -d /var/lib/bitlbee
then
mkdir -p /var/lib/bitlbee
chown bitlbee:bitlbee /var/lib/bitlbee
fi
'';
exec =
''
${pkgs.bitlbee}/sbin/bitlbee -F -p ${toString portNumber} \
-i ${interface} -u bitlbee
'';
};
environment.systemPackages = [ pkgs.bitlbee ];
};
}
|