nixos/services/crowdsec: update plugins to notificationPlugins

Just to be more specific for the FUTURE!
This commit is contained in:
Gabriel Arazas 2024-09-18 09:51:15 +08:00
parent c5eac6f3f9
commit abfa06a0c3
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360

View File

@ -29,7 +29,7 @@ let
default = pluginsDir; default = pluginsDir;
defaultText = '' defaultText = ''
All of the compiled plugins from All of the compiled plugins from
{options}`services.crowdsec.plugins.<name>.package`. {options}`services.crowdsec.notificationPlugins.<name>.package`.
''; '';
}; };
}; };
@ -51,10 +51,10 @@ let
}; };
pluginsDir = pkgs.symlinkJoin { pluginsDir = pkgs.symlinkJoin {
name = "crowdsec-system-plugins"; name = "crowdsec-system-notification-plugins";
paths = paths =
let let
plugins = lib.filterAttrs (n: v: v.package != null) cfg.plugins; plugins = lib.filterAttrs (n: v: v.package != null) cfg.notificationPlugins;
in in
lib.mapAttrsToList (n: v: "${v.package}/share/crowdsec") plugins; lib.mapAttrsToList (n: v: "${v.package}/share/crowdsec") plugins;
}; };
@ -63,9 +63,9 @@ let
pluginsConfigs = pluginsConfigs =
lib.mapAttrsToList lib.mapAttrsToList
(n: v: settingsFormat.generate "crowdsec-system-plugin-config-${n}" v.settings) (n: v: settingsFormat.generate "crowdsec-system-plugin-config-${n}" v.settings)
cfg.plugins; cfg.notificationPlugins;
in pkgs.symlinkJoin { in pkgs.symlinkJoin {
name = "crowdsec-system-plugins-configs"; name = "crowdsec-system-notification-plugins-configs";
paths = pluginsConfigs; paths = pluginsConfigs;
}; };
@ -159,10 +159,11 @@ in
''; '';
}; };
plugins = lib.mkOption { notificationPlugins = lib.mkOption {
type = with lib.types; attrsOf (submodule crowdsecPluginsModule); type = with lib.types; attrsOf (submodule crowdsecPluginsModule);
description = '' description = ''
Set of Crowdsec plugins and their configuration (if given). Set of Crowdsec notification plugins and their configuration (if
given).
''; '';
default = { }; default = { };
example = lib.literalExpression '' example = lib.literalExpression ''