nix icon indicating copy to clipboard operation
nix copied to clipboard

Command flag to force colored output for `nixos-rebuild`

Open fee1-dead opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. While piping nixos-rebuild to nix-output-monitor the text warning: Git tree '/etc/nixos' is dirty would lose its color

Describe the solution you'd like A command flag or an environment variable to turn colored output on even if the output is piped.

Describe alternatives you've considered None.

Additional context

Priorities

Add :+1: to issues you find important.

fee1-dead avatar Feb 13 '24 09:02 fee1-dead

https://github.com/NixOS/nix/pull/7650 would fix this

infinisil avatar Feb 19 '24 19:02 infinisil

Nope, it would not. This issue should be closed, since it is caused by nom nom'ing the terminal codes that Nix is unconditionally sending, so --color would have no influence.

https://github.com/NixOS/nix/blob/16fa5aa30556ab69d829e81a06d57e0807e69510/src/libutil/logging.cc#L33-L36

lf- avatar Mar 07 '24 02:03 lf-

Nope, it would not. This issue should be closed, since it is caused by nom nom'ing the terminal codes that Nix is unconditionally sending, so --color would have no influence.

It isn't unconditional, there is a function that filters out the ANSI codes depending on some factors:

https://github.com/NixOS/nix/blob/master/src/libutil/terminal.cc#L10-L84

fee1-dead avatar Mar 09 '24 12:03 fee1-dead

And that PR should probably fix this, since it touches the code that call filterANSIEscapes.

fee1-dead avatar Mar 09 '24 12:03 fee1-dead