diff options
author | Profpatsch <mail@profpatsch.de> | 2021-02-13T19·54+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-02-13T20·00+0000 |
commit | 5a08316a3c26f6df10a62c8962b1b468ebb30290 (patch) | |
tree | 9e8a9d6064c35ae5694f9752eb8b3cea2818b517 /users | |
parent | 18e6db0f2132cdc827687e2ada1d59aaf29ccb2a (diff) |
fix(users/Profpatsch/netencode/gen/dwim): support derivations r/2213
We forgot the special casing of derivations; if we recurse into a derivation like we’d recurse into an attrset, it always ends in tears, so dwim will just print the derivation path instead, which is usually what you want anyway. Change-Id: Ieed1b68dfcf8f2925ee3a75ae4f460fa5081da28 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2526 Reviewed-by: Profpatsch <mail@profpatsch.de> Tested-by: BuildkiteCI
Diffstat (limited to 'users')
-rw-r--r-- | users/Profpatsch/netencode/gen.nix | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/users/Profpatsch/netencode/gen.nix b/users/Profpatsch/netencode/gen.nix index 2d2456efeaa5..305ff7b08dd6 100644 --- a/users/Profpatsch/netencode/gen.nix +++ b/users/Profpatsch/netencode/gen.nix @@ -36,11 +36,15 @@ let "bool" = n1; "int" = i6; "string" = text; - "set" = attrs: record (lib.mapAttrsToList - (k: v: { - key = k; - val = dwim v; - }) attrs); + "set" = attrs: + # it could be a derivation, then just return the path + if attrs.type or "" == "derivation" then text "${attrs}" + else + record (lib.mapAttrsToList + (k: v: { + key = k; + val = dwim v; + }) attrs); "list" = l: list (map dwim l); }; in match.${builtins.typeOf val} val; |