Adding options to enable bitlbee and slack gateways in znc config.

This commit is contained in:
Tom Doggett 2017-05-17 15:03:12 -07:00
parent afec912d81
commit e28203fd48
No known key found for this signature in database
GPG key ID: C4252D5677A319CA

View file

@ -37,7 +37,7 @@ let
IPv6 = true
SSL = ${boolToString confOpts.useSSL}
</Listener>
<User ${confOpts.userName}>
${confOpts.passBlock}
Admin = true
@ -50,9 +50,12 @@ let
${ lib.concatStringsSep "\n" (lib.mapAttrsToList (name: net: ''
<Network ${name}>
${concatMapStrings (m: "LoadModule = ${m}\n") net.modules}
Server = ${net.server} ${if net.useSSL then "+" else ""}${toString net.port}
Server = ${net.server} ${lib.optionalString net.useSSL "+"}${toString net.port} ${net.password}
${concatMapStrings (c: "<Chan #${c}>\n</Chan>\n") net.channels}
${lib.optionalString net.hasBitlbeeControlChannel ''
<Chan &bitlbee></Chan>
''}
${net.extraConf}
</Network>
'') confOpts.networks) }
</User>
@ -85,6 +88,23 @@ let
'';
};
userName = mkOption {
default = "";
example = "johntron";
type = types.string;
description = ''
A nick identity specific to the IRC server.
'';
};
password = mkOption {
type = types.str;
default = "";
description = ''
IRC server password, such as for a Slack gateway.
'';
};
useSSL = mkOption {
type = types.bool;
default = true;
@ -119,6 +139,31 @@ let
IRC channels to join.
'';
};
hasBitlbeeControlChannel = mkOption {
type = types.bool;
default = false;
description = ''
Whether to add the special Bitlbee operations channel.
'';
};
extraConf = mkOption {
default = "";
type = types.lines;
example = ''
Encoding = ^UTF-8
FloodBurst = 4
FloodRate = 1.00
IRCConnectEnabled = true
Ident = johntron
JoinDelay = 0
Nick = johntron
'';
description = ''
Extra config for the network.
'';
};
};
};
@ -273,21 +318,21 @@ in
A list of global znc module packages to add to znc.
'';
};
mutable = mkOption {
default = false;
type = types.bool;
description = ''
Indicates whether to allow the contents of the `dataDir` directory to be changed
by the user at run-time.
If true, modifications to the ZNC configuration after its initial creation are not
If true, modifications to the ZNC configuration after its initial creation are not
overwritten by a NixOS system rebuild.
If false, the ZNC configuration is rebuilt by every system rebuild.
If the user wants to manage the ZNC service using the web admin interface, this value
should be set to true.
'';
};
extraFlags = mkOption {
default = [ ];
example = [ "--debug" ];
@ -334,7 +379,7 @@ in
if [[ ! -f ${cfg.dataDir}/znc.pem ]]; then
${pkgs.coreutils}/bin/echo "No znc.pem file found in ${cfg.dataDir}. Creating one now."
${pkgs.znc}/bin/znc --makepem --datadir ${cfg.dataDir}
${pkgs.znc}/bin/znc --makepem --datadir ${cfg.dataDir}
fi
# Symlink modules
@ -352,7 +397,7 @@ in
home = cfg.dataDir;
createHome = true;
};
users.extraGroups = optional (cfg.user == defaultUser)
{ name = defaultUser;
gid = config.ids.gids.znc;