From e28203fd482ffbc4b5d9cd3f4348399a6b2b12a2 Mon Sep 17 00:00:00 2001 From: Tom Doggett Date: Wed, 17 May 2017 15:03:12 -0700 Subject: [PATCH] Adding options to enable bitlbee and slack gateways in znc config. --- nixos/modules/services/networking/znc.nix | 61 ++++++++++++++++++++--- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix index 1c63d800e26..abd02012bc9 100644 --- a/nixos/modules/services/networking/znc.nix +++ b/nixos/modules/services/networking/znc.nix @@ -37,7 +37,7 @@ let IPv6 = true SSL = ${boolToString confOpts.useSSL} - + ${confOpts.passBlock} Admin = true @@ -50,9 +50,12 @@ let ${ lib.concatStringsSep "\n" (lib.mapAttrsToList (name: net: '' ${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: "\n\n") net.channels} + ${lib.optionalString net.hasBitlbeeControlChannel '' + + ''} + ${net.extraConf} '') confOpts.networks) } @@ -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;