about summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2024-02-27 20:49:39 -0500
committerGitHub <noreply@github.com>2024-02-27 20:49:39 -0500
commitf5622df47060a7670cc6d350ddb79815d5a1a3ef (patch)
treead85674faec43637acac23d0901cc950cf0117ae /nixos/lib
parenta976e65f11d02c8f64b00a3d124ff6de7a2f8fd0 (diff)
parent7d0c8129637823fc83e2b0aff9a4e945add51af9 (diff)
Merge pull request #290946 from ju1m/systemd-option-list
nixos/systemd: merge unit options as lists when at least one value is a list
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/systemd-unit-options.nix10
1 files changed, 2 insertions, 8 deletions
diff --git a/nixos/lib/systemd-unit-options.nix b/nixos/lib/systemd-unit-options.nix
index bc7880da9fe0e..e4953ba72dd92 100644
--- a/nixos/lib/systemd-unit-options.nix
+++ b/nixos/lib/systemd-unit-options.nix
@@ -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';
   };