7 cfg = config.services.znc;
14 example = "irc.libera.chat";
32 IRC server password, such as for a Slack gateway.
40 Whether to use SSL to connect to the IRC server.
45 type = types.listOf types.str;
46 default = [ "simple_away" ];
47 example = literalExpression ''[ "simple_away" "sasl" ]'';
49 ZNC network modules to load.
54 type = types.listOf types.str;
56 example = [ "nixos" ];
62 hasBitlbeeControlChannel = mkOption {
66 Whether to add the special Bitlbee operations channel.
70 extraConf = mkOption {
77 IRCConnectEnabled = true
83 Extra config for the network. Consider using
84 {option}`services.znc.config` instead.
97 useLegacyConfig = mkOption {
101 Whether to propagate the legacy options under
102 {option}`services.znc.confOptions.*` to the znc config. If this
103 is turned on, the znc config will contain a user with the default name
104 "znc", global modules "webadmin" and "adminlog" will be enabled by
105 default, and more, all controlled through the
106 {option}`services.znc.confOptions.*` options.
107 You can use {command}`nix-instantiate --eval --strict '<nixpkgs/nixos>' -A config.services.znc.config`
108 to view the current value of the config.
110 In any case, if you need more flexibility,
111 {option}`services.znc.config` can be used to override/add to
112 all of the legacy options.
118 type = types.listOf types.str;
119 default = [ "webadmin" "adminlog" ];
120 example = [ "partyline" "webadmin" "adminlog" "log" ];
122 A list of modules to include in the `znc.conf` file.
126 userModules = mkOption {
127 type = types.listOf types.str;
128 default = [ "chansaver" "controlpanel" ];
129 example = [ "chansaver" "controlpanel" "fish" "push" ];
131 A list of user modules to include in the `znc.conf` file.
135 userName = mkOption {
137 example = "johntron";
140 The user name used to log in to the ZNC web admin interface.
144 networks = mkOption {
146 type = with types; attrsOf (submodule networkOpts);
148 IRC networks to connect the user to.
150 example = literalExpression ''
153 server = "irc.libera.chat";
156 modules = [ "simple_away" ];
163 default = "znc-user";
171 passBlock = mkOption {
173 <Pass password>
175 Hash = e2ce303c7ea75c571d80d8540a8699b46535be6a085be3414947d638e48d9e93
176 Salt = l5Xryew4g*!oa(ECfX2o
181 Generate with {command}`nix-shell -p znc --command "znc --makepass"`.
182 This is the password used to log in to the ZNC web admin interface.
183 You can also set this through
184 {option}`services.znc.config.User.<username>.Pass.Method`
193 Specifies the port on which to listen.
201 Indicates whether the ZNC server should use SSL when listening on
202 the specified port. A self-signed certificate will be generated.
206 uriPrefix = mkOption {
207 type = types.nullOr types.str;
211 An optional URI prefix for the ZNC web interface. Can be
212 used to make ZNC available behind a reverse proxy.
216 extraZncConf = mkOption {
220 Extra config to `znc.conf` file.
228 config = mkIf cfg.useLegacyConfig {
230 services.znc.config = let
232 # defaults here should override defaults set in the non-legacy part
233 mkDefault = mkOverride 900;
235 LoadModule = mkDefault c.modules;
237 Port = mkDefault c.port;
238 IPv4 = mkDefault true;
239 IPv6 = mkDefault true;
240 SSL = mkDefault c.useSSL;
241 URIPrefix = c.uriPrefix;
243 User.${c.userName} = {
244 Admin = mkDefault true;
245 Nick = mkDefault c.nick;
246 AltNick = mkDefault "${c.nick}_";
247 Ident = mkDefault c.nick;
248 RealName = mkDefault c.nick;
249 LoadModule = mkDefault c.userModules;
250 Network = mapAttrs (name: net: {
251 LoadModule = mkDefault net.modules;
252 Server = mkDefault "${net.server} ${optionalString net.useSSL "+"}${toString net.port} ${net.password}";
253 Chan = optionalAttrs net.hasBitlbeeControlChannel { "&bitlbee" = mkDefault {}; } //
254 listToAttrs (map (n: nameValuePair "#${n}" (mkDefault {})) net.channels);
255 extraConfig = if net.extraConf == "" then mkDefault null else net.extraConf;
257 extraConfig = [ c.passBlock ];
259 extraConfig = optional (c.extraZncConf != "") c.extraZncConf;
264 (mkRemovedOptionModule ["services" "znc" "zncConf"] ''
265 Instead of `services.znc.zncConf = "... foo ...";`, use
266 `services.znc.configFile = pkgs.writeText "znc.conf" "... foo ...";`.