···
phpfpmSocketName = "/var/run/phpfpm/${poolName}.sock";
-
formatBool = b: if b then "1" else "0";
-
config = cfg.generalConfig;
-
show_stacktraces = "${formatBool config.showStacktraces}"
-
show_application_state_messages = "${formatBool config.showApplicationStateMessages}"
-
module_path = "${pkgs.icingaweb2}/modules${optionalString (builtins.length config.modulePath > 0) ":${concatStringsSep ":" config.modulePath}"}"
-
config_backend = "${config.configBackend}"
-
${optionalString (config.configBackend == "db") ''config_resource = "${config.configResource}"''}
-
${optionalString (config.log != "none") ''level = "${config.logLevel}"''}
-
${optionalString (config.log == "php" || config.log == "syslog") ''application = "${config.logApplication}"''}
-
${optionalString (config.log == "syslog") ''facility = "${config.logFacility}"''}
-
${optionalString (config.log == "file") ''file = "${config.logFile}"''}
-
default = "${config.themeDefault}"
-
disabled = "${formatBool config.themeDisabled}"
-
${optionalString (config.authDefaultDomain != null) ''default_domain = "${config.authDefaultDomain}"''}
-
resourcesIni = concatStringsSep "\n" (mapAttrsToList (name: config: ''
-
type = "${config.type}"
-
${optionalString (config.type == "db") ''
-
host = "${config.host}"
-
${optionalString (config.port != null) ''port = "${toString config.port}"''}
-
username = "${config.username}"
-
password = "${config.password}"
-
dbname = "${config.dbname}"
-
${optionalString (config.charset != null) ''charset = "${config.charset}"''}
-
use_ssl = "${formatBool config.useSSL}"
-
${optionalString (config.sslCert != null) ''ssl_cert = "${config.sslCert}"''}
-
${optionalString (config.sslKey != null) ''ssl_cert = "${config.sslKey}"''}
-
${optionalString (config.sslCA != null) ''ssl_cert = "${config.sslCA}"''}
-
${optionalString (config.sslCApath != null) ''ssl_cert = "${config.sslCApath}"''}
-
${optionalString (config.sslCipher != null) ''ssl_cert = "${config.sslCipher}"''}
-
${optionalString (config.type == "ldap") ''
-
hostname = "${config.host}"
-
${optionalString (config.port != null) ''port = "${toString config.port}"''}
-
root_dn = "${config.rootDN}"
-
bind_dn = "${config.username}"
-
bind_pw = "${config.password}"
-
encryption = "${config.ldapEncryption}"
-
timeout = "${toString config.ldapTimeout}"
-
${optionalString (config.type == "ssh") ''
-
user = "${config.username}"
-
private_key = "${config.sshPrivateKey}"
-
authenticationIni = concatStringsSep "\n" (mapAttrsToList (name: config: ''
-
backend = "${config.backend}"
-
${optionalString (config.domain != null) ''domain = "${config.domain}"''}
-
${optionalString (config.backend == "external" && config.externalStripRegex != null) ''strip_username_regexp = "${config.externalStripRegex}"''}
-
${optionalString (config.backend != "external") ''resource = "${config.resource}"''}
-
${optionalString (config.backend == "ldap" || config.backend == "msldap") ''
-
${optionalString (config.ldapUserClass != null) ''user_class = "${config.ldapUserClass}"''}
-
${optionalString (config.ldapUserNameAttr != null) ''user_name_attribute = "${config.ldapUserNameAttr}"''}
-
${optionalString (config.ldapFilter != null) ''filter = "${config.ldapFilter}"''}
-
'') cfg.authentications);
-
groupsIni = concatStringsSep "\n" (mapAttrsToList (name: config: ''
-
backend = "${config.backend}"
-
resource = "${config.resource}"
-
${optionalString (config.backend != "db") ''
-
${optionalString (config.ldapUserClass != null) ''user_class = "${config.ldapUserClass}"''}
-
${optionalString (config.ldapUserNameAttr != null) ''user_name_attribute = "${config.ldapUserNameAttr}"''}
-
${optionalString (config.ldapGroupClass != null) ''group_class = "${config.ldapGroupClass}"''}
-
${optionalString (config.ldapGroupNameAttr != null) ''group_name_attribute = "${config.ldapGroupNameAttr}"''}
-
${optionalString (config.ldapGroupFilter != null) ''group_filter = "${config.ldapGroupFilter}"''}
-
${optionalString (config.backend == "msldap" && config.ldapNestedSearch) ''nested_group_search = "1"''}
-
'') cfg.groupBackends);
-
optionalList = var: attribute: optionalString (builtins.length var > 0) ''${attribute} = "${concatStringsSep "," var}"'';
-
in concatStringsSep "\n" (mapAttrsToList (name: config: ''
-
${optionalList config.users "users"}
-
${optionalList config.groups "groups"}
-
${optionalList config.permissions "permissions"}
-
${optionalList config.permissions "permissions"}
-
${concatStringsSep "\n" (mapAttrsToList (key: value: optionalList value key) config.extraAssignments)}
options.services.icingaweb2 = with types; {
enable = mkEnableOption "the icingaweb2 web interface";
-
default = "${poolName}";
Name of existing PHP-FPM pool that is used to run Icingaweb2.
If not specified, a pool will automatically created with default values.
···
example = literalExample ''
-
"snow" = pkgs.icingaweb2Modules.theme-snow;
···
-
Make config.ini mutable (e.g. via the web interface).
-
Not that you need to update module_path manually.
-
showStacktraces = mkOption {
-
description = "Enable stack traces in the Web UI";
-
showApplicationStateMessages = mkOption {
-
description = "Enable application state messages in the Web UI";
-
modulePath = mkOption {
-
description = "List of additional module search paths";
-
configBackend = mkOption {
-
type = enum [ "ini" "db" "none" ];
-
description = "Where to store user preferences";
-
configResource = mkOption {
-
description = "Database resource where user preferences are stored (if they are stored in a database)";
-
type = enum [ "syslog" "php" "file" "none" ];
-
description = "Logging target";
-
type = enum [ "ERROR" "WARNING" "INFO" "DEBUG" ];
-
description = "Maximum logging level to emit";
-
logApplication = mkOption {
-
default = "icingaweb2";
-
description = "Application name to log under (syslog and php log)";
-
logFacility = mkOption {
-
type = enum [ "user" "local0" "local1" "local2" "local3" "local4" "local5" "local6" "local7" ];
-
description = "Syslog facility to log to";
-
default = "/var/log/icingaweb2/icingaweb2.log";
-
description = "File to log to";
-
themeDefault = mkOption {
-
description = "Name of the default theme";
-
themeDisabled = mkOption {
-
description = "Disallow users to change the theme";
-
authDefaultDomain = mkOption {
-
description = "Domain for users logging in without a qualified domain";
-
mutableResources = mkOption {
-
description = "Make resources.ini mutable (e.g. via the web interface)";
-
description = "Icingaweb 2 resources to define";
-
type = attrsOf (submodule ({ name, ... }: {
-
description = "Name of this resource";
-
type = enum [ "db" "ldap" "ssh" ];
-
description = "Type of this resouce";
-
type = enum [ "mysql" "pgsql" ];
-
description = "Type of this database resource";
-
description = "Host to connect to";
-
description = "Port to connect on";
-
description = "Database or SSH user or LDAP bind DN to connect with";
-
description = "Password for the database user or LDAP bind DN";
-
description = "Name of the database to connect to";
-
description = "Database character set to connect with";
-
description = "Whether to connect to the database using SSL";
-
description = "The file path to the SSL certificate. Only available for the mysql database.";
-
description = "The file path to the SSL key. Only available for the mysql database.";
-
description = "The file path to the SSL certificate authority. Only available for the mysql database.";
-
description = "The file path to the directory that contains the trusted SSL CA certificates in PEM format. Only available for the mysql database.";
-
description = "A list of one or more permissible ciphers to use for SSL encryption, in a format understood by OpenSSL. Only available for the mysql database.";
-
description = "Root object of the LDAP tree";
-
ldapEncryption = mkOption {
-
type = enum [ "none" "starttls" "ldaps" ];
-
description = "LDAP encryption to use";
-
ldapTimeout = mkOption {
-
description = "Connection timeout for every LDAP connection";
-
sshPrivateKey = mkOption {
-
description = "The path to the private key of the user";
-
mutableAuthConfig = mkOption {
-
description = "Make authentication.ini mutable (e.g. via the web interface)";
authentications = mkOption {
-
description = "Icingaweb 2 authentications to define";
-
type = attrsOf (submodule ({ name, ... }: {
-
description = "Name of this authentication";
-
type = enum [ "external" "ldap" "msldap" "db" ];
-
description = "The type of this authentication backend";
-
description = "Domain for domain-aware authentication";
-
externalStripRegex = mkOption {
-
description = "Regular expression to strip off specific user name parts";
-
description = "Name of the database/LDAP resource";
-
ldapUserClass = mkOption {
-
description = "LDAP user class";
-
ldapUserNameAttr = mkOption {
-
description = "LDAP attribute which contains the username";
-
ldapFilter = mkOption {
-
description = "LDAP search filter";
-
mutableGroupsConfig = mkOption {
-
description = "Make groups.ini mutable (e.g. via the web interface)";
groupBackends = mkOption {
-
description = "Icingaweb 2 group backends to define";
-
type = attrsOf (submodule ({ name, ... }: {
-
description = "Name of this group backend";
-
type = enum [ "ldap" "msldap" "db" ];
-
description = "The type of this group backend";
-
description = "Name of the database/LDAP resource";
-
ldapUserClass = mkOption {
-
description = "LDAP user class";
-
ldapUserNameAttr = mkOption {
-
description = "LDAP attribute which contains the username";
-
ldapGroupClass = mkOption {
-
description = "LDAP group class";
-
ldapGroupNameAttr = mkOption {
-
description = "LDAP attribute which contains the groupname";
-
ldapGroupFilter = mkOption {
-
description = "LDAP group search filter";
-
ldapNestedSearch = mkOption {
-
description = "Enable nested group search in Active Directory based on the user";
-
mutableRolesConfig = mkOption {
-
description = "Make roles.ini mutable (e.g. via the web interface)";
-
description = "Icingaweb 2 roles to define";
-
type = attrsOf (submodule ({ name, ... }: {
-
description = "Name of this role";
-
description = "List of users that are assigned to the role";
-
description = "List of groups that are assigned to the role";
-
permissions = mkOption {
-
example = [ "application/share/navigation" "config/*" ];
-
description = "The permissions to grant";
-
extraAssignments = mkOption {
-
type = attrsOf (listOf str);
-
example = { "monitoring/blacklist/properties" = [ "sla" "customer"]; };
-
description = "Additional assignments of this role";
config = mkIf cfg.enable {
services.phpfpm.poolConfigs = mkIf (cfg.pool == "${poolName}") {
-
listen = phpfpmSocketName;
-
extension = ${pkgs.phpPackages.imagick}/lib/php/extensions/imagick.so
-
date.timezone = "${cfg.timezone}"
-
pm.min_spare_servers = 2
-
pm.max_spare_servers = 10
systemd.services."phpfpm-${poolName}".serviceConfig.ReadWritePaths = [ "/etc/icingaweb2" ];
···
// doModule "translation"
-
// optionalAttrs (!cfg.generalConfig.mutable) { "icingaweb2/config.ini".text = configIni; }
-
// optionalAttrs (!cfg.mutableResources) { "icingaweb2/resources.ini".text = resourcesIni; }
-
// optionalAttrs (!cfg.mutableAuthConfig) { "icingaweb2/authentication.ini".text = authenticationIni; }
-
// optionalAttrs (!cfg.mutableGroupsConfig) { "icingaweb2/groups.ini".text = groupsIni; }
-
// optionalAttrs (!cfg.mutableRolesConfig) { "icingaweb2/roles.ini".text = rolesIni; };
users.groups.icingaweb2 = {};