aboutsummaryrefslogtreecommitdiff
path: root/src/nix/eval.cc
diff options
context:
space:
mode:
authorRebecca Turner <rbt@sent.as>2024-03-08 21:43:54 -0800
committerJade Lovelace <lix@jade.fyi>2024-03-08 23:46:16 -0800
commit6ef9d8efbadd6eee4a9ebf8ae0835c03989b6c3c (patch)
tree24864fb5aa98cc33ff5bfadf3af755ebfb0dd321 /src/nix/eval.cc
parent609a8e0d94926cae460ed6f12f1f8a3d9f91246b (diff)
Print derivation paths in `nix eval`
`nix eval` forces values and prints derivations as attribute sets, so commands that print derivations (e.g. `nix eval nixpkgs#bash`) will infinitely loop and segfault. Printing derivations as `.drv` paths makes `nix eval` complete as expected. Further work is needed, but this is better than a segfault. (cherry picked from commit 4910d74086a85876e093136a0e8ebc547b467af7) Change-Id: I8e1cb39c05db812080759ec183ee7a131760e6ea
Diffstat (limited to 'src/nix/eval.cc')
-rw-r--r--src/nix/eval.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nix/eval.cc b/src/nix/eval.cc
index 3dcc483fa..243705587 100644
--- a/src/nix/eval.cc
+++ b/src/nix/eval.cc
@@ -120,8 +120,17 @@ struct CmdEval : MixJSON, InstallableValueCommand, MixReadOnlyOption
}
else {
- state->forceValueDeep(*v);
- logger->cout("%s", ValuePrinter(*state, *v, PrintOptions { .force = true }));
+ logger->cout(
+ "%s",
+ ValuePrinter(
+ *state,
+ *v,
+ PrintOptions {
+ .force = true,
+ .derivationPaths = true
+ }
+ )
+ );
}
}
};