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
If I run nix eval with an installable that evaluates to a derivation, passing the --derivation flag does nothing. I expected it to evaluate to the derivation path (with or without the --raw flag). If I'm evaluating a single derivation I can add .drvPath myself (if I can remember to do so), but I always forget. And if I'm evaluating to some other structure that contains nested derivations that makes it much harder.
Steps To Reproduce
nix eval --raw --derivation nixpkgs#hello
nix eval --derivation nixpkgs#hello
nix eval --derivation nixpkgs#bat-extras (bat-extras is an attrset that contains derivations; also recurseForDerivations = true but that shouldn't matter here)
nix eval --derivation --expr 42
Expected behavior
(1) should print the same thing as nix eval --raw nixpkgs#hello.drvPath. Instead it prints the same thing as nix eval --raw nixpkgs#hello.
(2) should print some representation of the derivation. This could just be the drvPath (without quotes, this isn't a string), or perhaps do like nix repl and print e.g. «derivation /nix/store/bdxy7dq6l9xxpl2k2jx4sckgn93rhi0v-hello-2.10.drv».
(3) should print the attrset, except every nested derivation should be printed as a derivation instead of evaluated. I consider this a compelling reason to use syntax like «derivation /nix/store/bdxy7dq6l9xxpl2k2jx4sckgn93rhi0v-hello-2.10.drv» instead of bare paths, as that makes it clear what the type here is.
(4) is included because it involves no derivations. It should behave identically to nix eval --expr 42 as a result (as opposed to being an error). This just illustrates that the --derivation flag should serve to modify how derivations are evaluated rather than requiring the installable/expression to be a derivation or set of derivations.
I suppose another way to look at it is the --derivation flag should be roughly equivalent to running some sort of --apply 'x: mapRecursively (value: if isDerivation value then "«derivation ${value.drvPath}»" else value) (running after any actual --apply, and removing the quotes from the «derivation …» output, i.e. do this at the nix eval level instead of literally wrapping Nix code around it).
nix --version output
nix (Nix) 2.5.1
The text was updated successfully, but these errors were encountered:
Describe the bug
If I run
nix eval
with an installable that evaluates to a derivation, passing the--derivation
flag does nothing. I expected it to evaluate to the derivation path (with or without the--raw
flag). If I'm evaluating a single derivation I can add.drvPath
myself (if I can remember to do so), but I always forget. And if I'm evaluating to some other structure that contains nested derivations that makes it much harder.Steps To Reproduce
nix eval --raw --derivation nixpkgs#hello
nix eval --derivation nixpkgs#hello
nix eval --derivation nixpkgs#bat-extras
(bat-extras
is an attrset that contains derivations; alsorecurseForDerivations = true
but that shouldn't matter here)nix eval --derivation --expr 42
Expected behavior
(1) should print the same thing as
nix eval --raw nixpkgs#hello.drvPath
. Instead it prints the same thing asnix eval --raw nixpkgs#hello
.(2) should print some representation of the derivation. This could just be the drvPath (without quotes, this isn't a string), or perhaps do like
nix repl
and print e.g.«derivation /nix/store/bdxy7dq6l9xxpl2k2jx4sckgn93rhi0v-hello-2.10.drv»
.(3) should print the attrset, except every nested derivation should be printed as a derivation instead of evaluated. I consider this a compelling reason to use syntax like
«derivation /nix/store/bdxy7dq6l9xxpl2k2jx4sckgn93rhi0v-hello-2.10.drv»
instead of bare paths, as that makes it clear what the type here is.(4) is included because it involves no derivations. It should behave identically to
nix eval --expr 42
as a result (as opposed to being an error). This just illustrates that the--derivation
flag should serve to modify how derivations are evaluated rather than requiring the installable/expression to be a derivation or set of derivations.I suppose another way to look at it is the
--derivation
flag should be roughly equivalent to running some sort of--apply 'x: mapRecursively (value: if isDerivation value then "«derivation ${value.drvPath}»" else value)
(running after any actual--apply
, and removing the quotes from the«derivation …»
output, i.e. do this at thenix eval
level instead of literally wrapping Nix code around it).nix --version
outputnix (Nix) 2.5.1
The text was updated successfully, but these errors were encountered: