forked from lix-project/lix
nix eval --raw: Use coerceToString()
Thus, $ nix eval --raw '("foo")' foo $ nix eval --raw nixpkgs.hello /nix/store/1y6ckg6khrdsvll54s5spcmf3w6ka9k4-hello-2.10 $ nix eval --raw '(/etc/resolv.conf)' /nix/store/vml92ama92i8mz013nny461mlvg8mvap-resolv.conf
This commit is contained in:
parent
1ff01187e2
commit
f5f29dc2b7
|
@ -42,6 +42,10 @@ struct CmdEval : MixJSON, InstallablesCommand
|
||||||
"To get the current version of Nixpkgs:",
|
"To get the current version of Nixpkgs:",
|
||||||
"nix eval --raw nixpkgs.lib.nixpkgsVersion"
|
"nix eval --raw nixpkgs.lib.nixpkgsVersion"
|
||||||
},
|
},
|
||||||
|
Example{
|
||||||
|
"To print the store path of the Hello package:",
|
||||||
|
"nix eval --raw nixpkgs.hello"
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,10 +60,10 @@ struct CmdEval : MixJSON, InstallablesCommand
|
||||||
|
|
||||||
for (auto & i : installables) {
|
for (auto & i : installables) {
|
||||||
auto v = i->toValue(*state);
|
auto v = i->toValue(*state);
|
||||||
if (raw) {
|
|
||||||
std::cout << state->forceString(*v);
|
|
||||||
} else if (json) {
|
|
||||||
PathSet context;
|
PathSet context;
|
||||||
|
if (raw) {
|
||||||
|
std::cout << state->coerceToString(noPos, *v, context);
|
||||||
|
} else if (json) {
|
||||||
auto jsonElem = jsonOut->placeholder();
|
auto jsonElem = jsonOut->placeholder();
|
||||||
printValueAsJSON(*state, true, *v, jsonElem, context);
|
printValueAsJSON(*state, true, *v, jsonElem, context);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue