mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Test hacky way of making structured attrs
This commit is contained in:
parent
de71cebc3a
commit
a353b2f4b2
1 changed files with 8 additions and 0 deletions
|
@ -40,3 +40,11 @@ jsonOut="$(nix print-dev-env -f structured-attrs-shell.nix --json)"
|
|||
test "$(<<<"$jsonOut" jq '.structuredAttrs|keys|.[]' -r)" = "$(printf ".attrs.json\n.attrs.sh")"
|
||||
|
||||
test "$(<<<"$jsonOut" jq '.variables.outputs.value.out' -r)" = "$(<<<"$jsonOut" jq '.structuredAttrs.".attrs.json"' -r | jq -r '.outputs.out')"
|
||||
|
||||
# Hacky way of making structured attrs. We should preserve for now for back compat, but also deprecate.
|
||||
|
||||
hackyExpr='derivation { name = "a"; system = "foo"; builder = "/bin/sh"; __json = builtins.toJSON { a = 1; }; }'
|
||||
|
||||
# Check it works with the expected structured attrs
|
||||
hacky=$(nix-instantiate --expr "$hackyExpr")
|
||||
nix derivation show "$hacky" | jq --exit-status '."'"$hacky"'".env.__json | fromjson | . == {"a": 1}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue