Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #158602 from hercules-ci/systemd-unit-mixed-list-error

nixos/systemd: Custom error when mixing list/non-list defs

authored by Jörg Thalheim and committed by GitHub f5ca5310 b21933fa

Changed files
+8 -3
nixos
+8 -3
nixos/lib/systemd-unit-options.nix
··· 20 20 merge = loc: defs: 21 21 let 22 22 defs' = filterOverrides defs; 23 - defs'' = getValues defs'; 24 23 in 25 - if isList (head defs'') 26 - then concatLists defs'' 24 + if isList (head defs').value 25 + then concatMap (def: 26 + if builtins.typeOf def.value == "list" 27 + then def.value 28 + else 29 + 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'}" 30 + ) defs' 31 + 27 32 else mergeEqualOption loc defs'; 28 33 }; 29 34