Merge pull request #290946 from ju1m/systemd-option-list

nixos/systemd: merge unit options as lists when at least one value is a list
This commit is contained in:
Will Fancher 2024-02-27 20:49:39 -05:00 committed by GitHub
commit f5622df470
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 51 additions and 8 deletions

View file

@ -21,14 +21,8 @@ in rec {
let
defs' = filterOverrides defs;
in
if isList (head defs').value
then concatMap (def:
if builtins.typeOf def.value == "list"
then def.value
else
throw "The definitions for systemd unit options should be either all lists, representing repeatable options, or all non-lists, but for the option ${showOption loc}, the definitions are a mix of list and non-list ${lib.options.showDefs defs'}"
) defs'
if any (def: isList def.value) defs'
then concatMap (def: toList def.value) defs'
else mergeEqualOption loc defs';
};