mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/services.errbot: remove with lib;
This commit is contained in:
parent
57c0e18882
commit
0971178e73
1 changed files with 19 additions and 22 deletions
|
@ -1,7 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.errbot;
|
cfg = config.services.errbot;
|
||||||
pluginEnv = plugins: pkgs.buildEnv {
|
pluginEnv = plugins: pkgs.buildEnv {
|
||||||
|
@ -17,7 +14,7 @@ let
|
||||||
BOT_LOG_LEVEL = logging.${instanceCfg.logLevel}
|
BOT_LOG_LEVEL = logging.${instanceCfg.logLevel}
|
||||||
BOT_LOG_FILE = False
|
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}
|
BOT_IDENTITY = ${builtins.toJSON instanceCfg.identity}
|
||||||
|
|
||||||
|
@ -25,48 +22,48 @@ let
|
||||||
'';
|
'';
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
services.errbot.instances = mkOption {
|
services.errbot.instances = lib.mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
description = "Errbot instance configs";
|
description = "Errbot instance configs";
|
||||||
type = types.attrsOf (types.submodule {
|
type = lib.types.attrsOf (lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
dataDir = mkOption {
|
dataDir = lib.mkOption {
|
||||||
type = types.nullOr types.path;
|
type = lib.types.nullOr lib.types.path;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Data directory for errbot instance.";
|
description = "Data directory for errbot instance.";
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = mkOption {
|
plugins = lib.mkOption {
|
||||||
type = types.listOf types.package;
|
type = lib.types.listOf lib.types.package;
|
||||||
default = [];
|
default = [];
|
||||||
description = "List of errbot plugin derivations.";
|
description = "List of errbot plugin derivations.";
|
||||||
};
|
};
|
||||||
|
|
||||||
logLevel = mkOption {
|
logLevel = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
default = "INFO";
|
default = "INFO";
|
||||||
description = "Errbot log level";
|
description = "Errbot log level";
|
||||||
};
|
};
|
||||||
|
|
||||||
admins = mkOption {
|
admins = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [];
|
default = [];
|
||||||
description = "List of identifiers of errbot admins.";
|
description = "List of identifiers of errbot admins.";
|
||||||
};
|
};
|
||||||
|
|
||||||
backend = mkOption {
|
backend = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
default = "XMPP";
|
default = "XMPP";
|
||||||
description = "Errbot backend name.";
|
description = "Errbot backend name.";
|
||||||
};
|
};
|
||||||
|
|
||||||
identity = mkOption {
|
identity = lib.mkOption {
|
||||||
type = types.attrs;
|
type = lib.types.attrs;
|
||||||
description = "Errbot identity configuration";
|
description = "Errbot identity configuration";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = lib.mkOption {
|
||||||
type = types.lines;
|
type = lib.types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
description = "String to be appended to the config verbatim";
|
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 = {
|
users.users.errbot = {
|
||||||
group = "errbot";
|
group = "errbot";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
};
|
};
|
||||||
users.groups.errbot = {};
|
users.groups.errbot = {};
|
||||||
|
|
||||||
systemd.services = mapAttrs' (name: instanceCfg: nameValuePair "errbot-${name}" (
|
systemd.services = lib.mapAttrs' (name: instanceCfg: lib.nameValuePair "errbot-${name}" (
|
||||||
let
|
let
|
||||||
dataDir = if instanceCfg.dataDir != null then instanceCfg.dataDir else
|
dataDir = if instanceCfg.dataDir != null then instanceCfg.dataDir else
|
||||||
"/var/lib/errbot/${name}";
|
"/var/lib/errbot/${name}";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue