mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
nixos/services/crowdsec: update default method for setting service config
This commit is contained in:
parent
9107bdb9b5
commit
ab38c4604e
@ -7,47 +7,32 @@ let
|
|||||||
|
|
||||||
settingsSubmodule = { lib, ... }: {
|
settingsSubmodule = { lib, ... }: {
|
||||||
freeformType = settingsFormat.type;
|
freeformType = settingsFormat.type;
|
||||||
options.config_paths = {
|
|
||||||
notification_dir = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = ''
|
|
||||||
Directory where configuration files of notification plugins are kept.
|
|
||||||
'';
|
|
||||||
default = pluginsConfigDrv;
|
|
||||||
defaultText = ''
|
|
||||||
All of the compiled configuration files from
|
|
||||||
{option}`services.crowdsec.plugins.<name>.settings`.
|
|
||||||
'';
|
|
||||||
example = "./config/crowdsec/plugins";
|
|
||||||
};
|
|
||||||
|
|
||||||
plugin_dir = lib.mkOption {
|
# Set all of the related Crowdsec configuration options from the user-given
|
||||||
type = lib.types.path;
|
# service module config.
|
||||||
description = ''
|
config = lib.mkMerge [
|
||||||
Directory where plugin executables are kept.
|
(
|
||||||
'';
|
let
|
||||||
default = pluginsDir;
|
plugins = lib.filterAttrs (n: v: v.package != null) cfg.notificationPlugins;
|
||||||
defaultText = ''
|
in
|
||||||
All of the compiled plugins from
|
lib.mkIf (plugins != { }) {
|
||||||
{options}`services.crowdsec.notificationPlugins.<name>.package`.
|
config_paths.plugin_dir = lib.mkDefault pluginsDir;
|
||||||
'';
|
}
|
||||||
};
|
)
|
||||||
};
|
|
||||||
|
|
||||||
options.crowdsec_service = {
|
(
|
||||||
acqusition_dir = lib.mkOption {
|
let
|
||||||
type = lib.types.path;
|
pluginsSettings = lib.filterAttrs (n: v: v.settings != { }) cfg.notificationPlugins;
|
||||||
description = ''
|
in
|
||||||
Directory containing acqusition configurations.
|
lib.mkIf (pluginsSettings != { }) {
|
||||||
'';
|
config_paths.notification_dir = lib.mkDefault pluginsConfigDrv;
|
||||||
default = acqusitionsDir;
|
}
|
||||||
defaultText = ''
|
)
|
||||||
All of the compiled configuration from
|
|
||||||
{options}`services.crowdsec.acqusitions.<name>.settings`.
|
(lib.mkIf (cfg.dataSources != { }) {
|
||||||
'';
|
crowdsec_service.acqusition_dir = lib.mkDefault acqusitionsDir;
|
||||||
example = "./config/crowdsec/acqusitions";
|
})
|
||||||
};
|
];
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pluginsDir = pkgs.symlinkJoin {
|
pluginsDir = pkgs.symlinkJoin {
|
||||||
@ -89,7 +74,7 @@ let
|
|||||||
::: {.caution}
|
::: {.caution}
|
||||||
This setting is effectively ignored if
|
This setting is effectively ignored if
|
||||||
{option}`services.crowdsec.settings.config_paths.notification_dir` is
|
{option}`services.crowdsec.settings.config_paths.notification_dir` is
|
||||||
set.
|
set manually.
|
||||||
:::
|
:::
|
||||||
'';
|
'';
|
||||||
default = { };
|
default = { };
|
||||||
|
Loading…
Reference in New Issue
Block a user