diff --git a/nixos/modules/services/misc/errbot.nix b/nixos/modules/services/misc/errbot.nix index b447ba5d438d..1c7135e774e8 100644 --- a/nixos/modules/services/misc/errbot.nix +++ b/nixos/modules/services/misc/errbot.nix @@ -1,7 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; - let cfg = config.services.errbot; pluginEnv = plugins: pkgs.buildEnv { @@ -17,7 +14,7 @@ let BOT_LOG_LEVEL = logging.${instanceCfg.logLevel} BOT_LOG_FILE = False - BOT_ADMINS = (${concatMapStringsSep "," (name: "'${name}'") instanceCfg.admins}) + BOT_ADMINS = (${lib.concatMapStringsSep "," (name: "'${name}'") instanceCfg.admins}) BOT_IDENTITY = ${builtins.toJSON instanceCfg.identity} @@ -25,48 +22,48 @@ let ''; in { options = { - services.errbot.instances = mkOption { + services.errbot.instances = lib.mkOption { default = {}; description = "Errbot instance configs"; - type = types.attrsOf (types.submodule { + type = lib.types.attrsOf (lib.types.submodule { options = { - dataDir = mkOption { - type = types.nullOr types.path; + dataDir = lib.mkOption { + type = lib.types.nullOr lib.types.path; default = null; description = "Data directory for errbot instance."; }; - plugins = mkOption { - type = types.listOf types.package; + plugins = lib.mkOption { + type = lib.types.listOf lib.types.package; default = []; description = "List of errbot plugin derivations."; }; - logLevel = mkOption { - type = types.str; + logLevel = lib.mkOption { + type = lib.types.str; default = "INFO"; description = "Errbot log level"; }; - admins = mkOption { - type = types.listOf types.str; + admins = lib.mkOption { + type = lib.types.listOf lib.types.str; default = []; description = "List of identifiers of errbot admins."; }; - backend = mkOption { - type = types.str; + backend = lib.mkOption { + type = lib.types.str; default = "XMPP"; description = "Errbot backend name."; }; - identity = mkOption { - type = types.attrs; + identity = lib.mkOption { + type = lib.types.attrs; description = "Errbot identity configuration"; }; - extraConfig = mkOption { - type = types.lines; + extraConfig = lib.mkOption { + type = lib.types.lines; default = ""; description = "String to be appended to the config verbatim"; }; @@ -75,14 +72,14 @@ in { }; }; - config = mkIf (cfg.instances != {}) { + config = lib.mkIf (cfg.instances != {}) { users.users.errbot = { group = "errbot"; isSystemUser = true; }; users.groups.errbot = {}; - systemd.services = mapAttrs' (name: instanceCfg: nameValuePair "errbot-${name}" ( + systemd.services = lib.mapAttrs' (name: instanceCfg: lib.nameValuePair "errbot-${name}" ( let dataDir = if instanceCfg.dataDir != null then instanceCfg.dataDir else "/var/lib/errbot/${name}";