Offer a way to configure nicer output with old nix-{build,shell} #288

Closed
opened 2024-05-09 16:11:42 +00:00 by fireyfly · 5 comments

It came up last night in #discuss that you can get the bar-with-logs output format with old-CLI commands as well by passing --log-format bar-with-logs (which I somehow never realised...)

I couldn't find a configuration option (in either cppnix or in lix) to set the log format (at least for interactive use), so this is basically a feature request for that.

I think it'd be nice to default to bar-with-logs in interactive use and raw otherwise (so as to not break tooling that relies on parsing the raw build output)... but that might still be considered too much a breaking change vs cppnix at this stage?

Another option would be to add a log-format (or interactive-log-format) nix.conf setting. The status quo already allows alias nix-build=nix-build --log-format bar-with-logs so it might just be considered Good Enough™

It came up last night in #discuss that you can get the `bar-with-logs` output format with old-CLI commands as well by passing `--log-format bar-with-logs` (which I somehow never realised...) I couldn't find a configuration option (in either cppnix or in lix) to set the log format (at least for interactive use), so this is basically a feature request for that. I think it'd be nice to default to `bar-with-logs` in interactive use and `raw` otherwise (so as to not break tooling that relies on parsing the raw build output)... but that might still be considered too much a breaking change vs cppnix at this stage? Another option would be to add a `log-format` (or `interactive-log-format`) nix.conf setting. The status quo already allows `alias nix-build=nix-build --log-format bar-with-logs` so it might just be considered Good Enough™
Owner

the determination whether a single invocation is interactive or not is not really something lix can reasonably do? putting the alias you gave into a .bash_profile or equivalent might be the only way to do this that doesn't cause huge amounts of breakage :(

the determination whether a single invocation is interactive or not is not really something lix can reasonably do? putting the alias you gave into a `.bash_profile` or equivalent might be the only way to do this that doesn't cause huge amounts of breakage :(
Author

hm, I figured "is stdout a tty?" would do it (early on in the entrypoint), but maybe that would cause complications I'm not seeing? I guess the alias is enough for now otherwise (and like, a separate lix CLI could always come with nicer defaults in the future)

hm, I figured "is stdout a tty?" would do it (early on in the entrypoint), but maybe that would cause complications I'm not seeing? I guess the alias is enough for now otherwise (and like, a separate lix CLI could always come with nicer defaults in the future)
Owner

hm, I figured "is stdout a tty?" would do it (early on in the entrypoint), but maybe that would cause complications I'm not seeing? I guess the alias is enough for now otherwise (and like, a separate lix CLI could always come with nicer defaults in the future)

nope unfortunately people shove things in pseudoterminals with alarming frequency if they do stuff like building CI systems or so. it's rather unfortunate.

> hm, I figured "is stdout a tty?" would do it (early on in the entrypoint), but maybe that would cause complications I'm not seeing? I guess the alias is enough for now otherwise (and like, a separate lix CLI could always come with nicer defaults in the future) nope unfortunately people shove things in pseudoterminals with alarming frequency if they do stuff like building CI systems or so. it's rather unfortunate.
Owner

we also suggest nix build -L -f . someattr for non flakes builds on the nix-command cli. it's not the nicest syntax (i have an alias nb that adds the -L for print build logs) but it does improve this.

we also suggest `nix build -L -f . someattr` for non flakes builds on the nix-command cli. it's not the nicest syntax (i have an alias nb that adds the -L for print build logs) but it does improve this.
Author

hmm yeah okay, I guess it's not really realistic then to do something nicer within the confines of cppnix's interface :\

tbh a lot of it is just old-cli being in muscle memory/in my mental model so I think I'll just add aliases for those to start with, but appreciate the suggestion. I'll close this then as I don't think it can really be implemented if stdout-is-tty isn't reliable enough

hmm yeah okay, I guess it's not really realistic then to do something nicer within the confines of cppnix's interface :\ tbh a lot of it is just old-cli being in muscle memory/in my mental model so I think I'll just add aliases for those to start with, but appreciate the suggestion. I'll close this then as I don't think it can really be implemented if stdout-is-tty isn't reliable enough
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#288
No description provided.