You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When using nix programatically, it is useful to pass in structured data to a nix expression.
Describe the solution you'd like
I'd like to be able to pass --argjson args '{"some": "args"}' and have the nix expression receive the nix value {some = "args";}, rather than needing to use --argstr and then builtins.fromJSON on the result. The would mean the expression being called doesn't need to make allowances for being called from outside nix, and can just take a structured value.
Describe alternatives you've considered
It is currently possible to do this via something like
Is your feature request related to a problem? Please describe.
When using nix programatically, it is useful to pass in structured data to a nix expression.
Describe the solution you'd like
I'd like to be able to pass
--argjson args '{"some": "args"}'
and have the nix expression receive the nix value{some = "args";}
, rather than needing to use--argstr
and thenbuiltins.fromJSON
on the result. The would mean the expression being called doesn't need to make allowances for being called from outside nix, and can just take a structured value.Describe alternatives you've considered
It is currently possible to do this via something like
and running it with
nix build -f example.nix --argstr '{"some": "args"}
.Additional context
For example, in https://github.com/DBCDK/morph/pull/186/files#diff-cf26037a329af2f212a4b7c055c4466aaa4d04fae33fc0a711a6353291025e57R111 I need some extra logic to deal with potentially being passed a JSON argument. If instead there was
--argjson
, I could just pass--argjson names '["node1", "node2"]
and remove the logic in nix aroundargsJSON
. I currently have code like the followingbut with this option, I could simply have
The text was updated successfully, but these errors were encountered: