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;
130 A list of modules to include in the `znc.conf` file.
134 userModules = mkOption {
135 type = types.listOf types.str;
147 A list of user modules to include in the `znc.conf` file.
151 userName = mkOption {
153 example = "johntron";
156 The user name used to log in to the ZNC web admin interface.
160 networks = mkOption {
162 type = with types; attrsOf (submodule networkOpts);
164 IRC networks to connect the user to.
166 example = literalExpression ''
169 server = "irc.libera.chat";
172 modules = [ "simple_away" ];
179 default = "znc-user";
187 passBlock = mkOption {
189 <Pass password>
191 Hash = e2ce303c7ea75c571d80d8540a8699b46535be6a085be3414947d638e48d9e93
192 Salt = l5Xryew4g*!oa(ECfX2o
197 Generate with {command}`nix-shell -p znc --command "znc --makepass"`.
198 This is the password used to log in to the ZNC web admin interface.
199 You can also set this through
200 {option}`services.znc.config.User.<username>.Pass.Method`
209 Specifies the port on which to listen.
217 Indicates whether the ZNC server should use SSL when listening on
218 the specified port. A self-signed certificate will be generated.
222 uriPrefix = mkOption {
223 type = types.nullOr types.str;
227 An optional URI prefix for the ZNC web interface. Can be
228 used to make ZNC available behind a reverse proxy.
232 extraZncConf = mkOption {
236 Extra config to `znc.conf` file.
244 config = mkIf cfg.useLegacyConfig {
246 services.znc.config =
249 # defaults here should override defaults set in the non-legacy part
250 mkDefault = mkOverride 900;
253 LoadModule = mkDefault c.modules;
255 Port = mkDefault c.port;
256 IPv4 = mkDefault true;
257 IPv6 = mkDefault true;
258 SSL = mkDefault c.useSSL;
259 URIPrefix = c.uriPrefix;
261 User.${c.userName} = {
262 Admin = mkDefault true;
263 Nick = mkDefault c.nick;
264 AltNick = mkDefault "${c.nick}_";
265 Ident = mkDefault c.nick;
266 RealName = mkDefault c.nick;
267 LoadModule = mkDefault c.userModules;
268 Network = mapAttrs (name: net: {
269 LoadModule = mkDefault net.modules;
270 Server = mkDefault "${net.server} ${optionalString net.useSSL "+"}${toString net.port} ${net.password}";
272 optionalAttrs net.hasBitlbeeControlChannel { "&bitlbee" = mkDefault { }; }
273 // listToAttrs (map (n: nameValuePair "#${n}" (mkDefault { })) net.channels);
274 extraConfig = if net.extraConf == "" then mkDefault null else net.extraConf;
276 extraConfig = [ c.passBlock ];
278 extraConfig = optional (c.extraZncConf != "") c.extraZncConf;
283 (mkRemovedOptionModule [ "services" "znc" "zncConf" ] ''
284 Instead of `services.znc.zncConf = "... foo ...";`, use
285 `services.znc.configFile = pkgs.writeText "znc.conf" "... foo ...";`.