Implement --raw for nix-instantiate --eval#9361
Implement --raw for nix-instantiate --eval#9361infinisil wants to merge 1 commit intoNixOS:masterfrom
Conversation
|
This seems fine to me.
I think while we shouldn't prioritize these things, if someone is willing to put in the work we shouldn't stop them either. |
|
I agree with John, but also I would use this. |
| std::cout << std::endl; | ||
| } else if (output == okRaw) { | ||
| std::cout << *state.coerceToString(noPos, vRes, context, "while generating the nix-instantiate output"); | ||
| std::cout << std::endl; |
There was a problem hiding this comment.
nix eval --raw is even more raw, by not adding a trailing newline.
writeFull(STDOUT_FILENO, *state->coerceToString(noPos, *v, context, "while generating the eval command output"));
I think in both commands, we should make the extra newline dependent on whether stdout is a tty, probably as a general rule to be implemented in the proposed (elsewhere) function that factors out the stopProgressBar() + writeFull(STDOUT... combination.
There was a problem hiding this comment.
Also I see no reason why we couldn't stop the progress bar in the old CLI.
If we don't have one, stopping it should just be a no-op.
There was a problem hiding this comment.
Fwiw: There's a logger->pause() (and a corresponding logger->resume() method that's marginally more generic than stopProgressBar (well, in practice it does the same thing, but it's more future-proof).
|
See, now we're even discussing the new CLI, which actually is a priority. |
|
This would improve the documentation as well @infinisil are you still interested in completing this PR? |
|
Interested yes, but not sufficient availability right now :) I think this would be a great to label/advertise as a first good issue :) |
|
As discussed in #dev:nixos.org I went ahead and picked this up in #12119. |
|
@not-my-profile Thank you! ❤️ |
Motivation
For ages now I've been doing hacks like
to get to the raw string content in the stable CLI.
Today I've had enough and went on to implement
--rawwithin like 10 minutes and only a single compilation error.Context
nix evalalready supports--raw.Implements
--rawfornix-instantiate:Not yet documented or tested.
On one hand the Nix team might be inclined to reject this because it changes the old CLI when you're trying to focus on the new one.
On the other hand, this is a 6 line change..
Priorities
Add 👍 to pull requests you find important.