@ -86,18 +86,17 @@ in
inputConfig = mkOption {
default = { } ;
description = ''
An attr set representing a logstash configuration's input section .
A nixexpr representing a logstash configuration's input section .
logstash configs are name-value pairs , where values can be bools ,
strings , numbers , arrays , hashes , or other name-value pairs ,
and names are strings that can be repeated . name-value pairs with no
repeats are represented by attr sets . name-value pairs with repeats
are represented by an attrset with attr " _ _ t y p e " = " r e p e a t e d " and
attr " v a l u e s " as a list of { name ; value ; } attrsets .
bools , strings , ints , and arrays are mapped directly . Floats are
represented as an attrset with attr " _ _ t y p e " = " f l o a t " and attr value
set to the string representation of the float . Hashes are represented
with attr " _ _ t y p e " = " h a s h " and attr value set to an attr set
corresponding to the hash .
repeats are represented by attr sets . bools , strings , ints , and
arrays are mapped directly . name-value pairs with repeats can be
generated by the config . lib . logstash . mkNameValuePairs function , which
takes a list of attrsets and combines them while preserving attribute
name duplicates if they occur . Similarly , there are the mkFloat and
mkHash functions , which take a string representation of a float and an
attrset , respectively .
'' ;
merge = mergeConfigs ;
} ;
@ -125,7 +124,15 @@ in
###### implementation
config = mkIf cfg . enable {
config = mkMerge [ {
lib . logstash = {
mkFloat = stringRep : { __type = " f l o a t " ; value = stringRep ; } ;
mkHash = attrs : { __type = " h a s h " ; value = attrs ; } ;
mkNameValuePairs = mergeConfigs ;
} ;
} ( mkIf cfg . enable {
# Always log to stdout
services . logstash . outputConfig = { stdout = { } ; } ;
@ -148,5 +155,5 @@ in
}
'' } " ;
} ;
} ;
} ) ] ;
}