commit fc0396591536cab970f7114caeb30c883e9d83d4 parent d2d3af25879d23590faba799ba693ad3e531f00f Author: Daniel Barlow <dan@telent.net> Date: Wed, 14 Aug 2024 22:56:01 +0100 hostapd literal_or_output use an attrset for dispatch Diffstat:
| M | modules/hostapd/service.nix | | | 12 | +++++------- |
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/modules/hostapd/service.nix b/modules/hostapd/service.nix @@ -25,13 +25,11 @@ let ctrl_interface_group = 0; }; attrs = defaults // params ; - literal_or_output = o: - let typ = builtins.typeOf o; - in if typ == "string" - then builtins.toJSON o - else if typ == "int" - then builtins.toJSON o - else "output(${builtins.toJSON o.service}, ${builtins.toJSON o.path})"; + literal_or_output = o: ({ + string = builtins.toJSON; + int = builtins.toJSON; + set = (o: "output(${builtins.toJSON o.service}, ${builtins.toJSON o.path})"); + }.${builtins.typeOf o}) o; format_value = n : v: "${n}={{ ${literal_or_output v} }}"; conf =