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
This is expected. The file you're evaluating is a function, why should it apply the argument if you're just evaluating? Note that if the body of a function were an attribute set and you request a specific attribute, the argument will be applied, e.g. try nix-instantiate --eval -E '{ foo }: { inherit foo; }' --arg foo true -A foo
Ultimately, I just wanted to print the resulting derivation - in ATerm and/or XML. (For context: I'm writing a Nix tutorial in the same vein as "Learn Python The Hard Way", wherein I introduce concepts by way of simple CLI examples, increasing in complexity as I go).
Perhaps my mental model is off, resulting in faulty expectations; given my current understanding, I can't see why I should need to specify an attr in order for the output to reflect the application. Is this a matter of laziness (i.e. function application is non-strict whereas attr resolution is strict, and thus my original examples results in an unevaluated thunk, whereas yours fully evaluates to true)? If that's the case, I would have expected the result to (at least) be in WHNF. Another thing I just realized: --strict makes no difference, which suggests that this theory isn't accurate.
If it's not a matter of laziness, I'm not sure what else I might be misunderstanding.
Does any of the above betray any ignorance/confusion on my part that you might be able to help me better understand? Can you explain why it shouldn't apply the argument? Are there any components of the Nix toolchain that depend on nix-instantiate exhibiting this behavior?
For my purposes, I can accomplish what I want through indirection - having another "wrapper" file perform the application:
Activity
shlevy commentedon May 12, 2014
This is expected. The file you're evaluating is a function, why should it apply the argument if you're just evaluating? Note that if the body of a function were an attribute set and you request a specific attribute, the argument will be applied, e.g. try
nix-instantiate --eval -E '{ foo }: { inherit foo; }' --arg foo true -A foocstrahan commentedon May 12, 2014
Ultimately, I just wanted to print the resulting derivation - in ATerm and/or XML. (For context: I'm writing a Nix tutorial in the same vein as "Learn Python The Hard Way", wherein I introduce concepts by way of simple CLI examples, increasing in complexity as I go).
Perhaps my mental model is off, resulting in faulty expectations; given my current understanding, I can't see why I should need to specify an attr in order for the output to reflect the application. Is this a matter of laziness (i.e. function application is non-strict whereas attr resolution is strict, and thus my original examples results in an unevaluated thunk, whereas yours fully evaluates to
true)? If that's the case, I would have expected the result to (at least) be in WHNF. Another thing I just realized:--strictmakes no difference, which suggests that this theory isn't accurate.If it's not a matter of laziness, I'm not sure what else I might be misunderstanding.
Does any of the above betray any ignorance/confusion on my part that you might be able to help me better understand? Can you explain why it shouldn't apply the argument? Are there any components of the Nix toolchain that depend on
nix-instantiateexhibiting this behavior?For my purposes, I can accomplish what I want through indirection - having another "wrapper" file perform the application:
While that works, it's unintuitive (at least to me) and doesn't present quite as well in my tutorial as passing a simple command line argument.
edolstra commentedon May 13, 2014
Yeah, it's a bit inconsistent. Note that it does use the arguments in conjunction with
-A:cstrahan commentedon May 13, 2014
Awesome - thanks!
Merge pull request NixOS#254 from DeterminateSystems/RossComputerGuy/…
doc/inventory: 2026-05 adversarial audit — corrections, NixOS#241-Nix…