Skip to content

Commit 025f9e7

Browse files
committed
Test hacky way of making structured attrs
1 parent 32d1904 commit 025f9e7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/functional/structured-attrs.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,11 @@ jsonOut="$(nix print-dev-env -f structured-attrs-shell.nix --json)"
4040
test "$(<<<"$jsonOut" jq '.structuredAttrs|keys|.[]' -r)" = "$(printf ".attrs.json\n.attrs.sh")"
4141

4242
test "$(<<<"$jsonOut" jq '.variables.outputs.value.out' -r)" = "$(<<<"$jsonOut" jq '.structuredAttrs.".attrs.json"' -r | jq -r '.outputs.out')"
43+
44+
# Hacky way of making structured attrs. We should preserve for now for back compat, but also deprecate.
45+
46+
hackyExpr='derivation { name = "a"; system = "foo"; builder = "/bin/sh"; __json = builtins.toJSON { a = 1; }; }'
47+
48+
# Check it works with the expected structured attrs
49+
hacky=$(nix-instantiate --expr "$hackyExpr")
50+
nix derivation show "$hacky" | jq --exit-status '."'"$hacky"'".env.__json | fromjson | . == {"a": 1}'

0 commit comments

Comments
 (0)