Refactor parsers in crowdsec module to make use of symlinkjoin
Fixes failing build when running nix flake check --no-build because store paths may not be present.
This commit is contained in:
@@ -10,17 +10,9 @@
|
||||
|
||||
pkg = cfg.package;
|
||||
|
||||
defaultPatterns = lib.mapAttrs (name: value: lib.mkDefault "${pkg}/share/crowdsec/config/patterns/${name}") (builtins.readDir "${pkg}/share/crowdsec/config/patterns");
|
||||
defaultPatterns = [pkg.patterns];
|
||||
|
||||
patternsDir = pkgs.runCommandNoCC "crowdsec-patterns" {} ''
|
||||
mkdir -p $out
|
||||
${lib.concatStringsSep "\n" (lib.attrValues (lib.mapAttrs (
|
||||
k: v: ''
|
||||
ln -sf ${v} $out/${k}
|
||||
''
|
||||
)
|
||||
cfg.patterns))}
|
||||
'';
|
||||
patternsDir = pkgs.symlinkJoin { name = "crowdsec-merged-patterns"; paths = [cfg.patterns];};
|
||||
|
||||
defaultSettings = with lib; {
|
||||
common = {
|
||||
@@ -118,14 +110,15 @@ in {
|
||||
};
|
||||
patterns = mkOption {
|
||||
description = mdDoc ''
|
||||
A set of pattern files for parsing logs, in the form "type" to file containing the corresponding GROK patterns.
|
||||
A list of pattern derrivations for parsing logs, in the form "type" to file containing the corresponding GROK patterns.
|
||||
Files in the derriviatons will be merged into one and must only contains files in the root of the derivation.
|
||||
All default patterns are automatically included.
|
||||
See <https://github.com/crowdsecurity/crowdsec/tree/master/config/patterns>.
|
||||
'';
|
||||
type = types.attrsOf types.pathInStore;
|
||||
default = {};
|
||||
type = types.listOf types.package; #types.attrsOf types.pathInStore;
|
||||
default = [];
|
||||
example = lib.literalExpression ''
|
||||
{ ssh = ./patterns/ssh;}
|
||||
[ (pkgs.writeTextDir "ssh" (builtins.readFile ./ssh)) ]
|
||||
'';
|
||||
};
|
||||
settings = mkOption {
|
||||
|
||||
Reference in New Issue
Block a user