Howdy, I’m using build to invoke rustc to create a bin and run rust tests and it’s pretty sweet, and color output works fine on my terminal except when I do it in a nix derivation, for some reason it doesn’t want to print out in color (all other commands I have do print out in color). I asked over at the nix discourse as well, but figured I’d ask here as well in case anyone had any ideas. That thread is: Dune test output refuses to print with color in the derivation sandbox - Help - NixOS Discourse
Oddly enough, on macos it does print in color in the derivation, but it has some extra character ( (B ) appended to each colored output:
> test single_arg_shell_single_attr ... ok(B
>
> thread 'single_arg_flake_multi_attr' (5459192) panicked at test_ns.rs:81:5:
> assertion failed: false
> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
> test single_arg_flake_single_attr ... ok(B
> test single_arg_flake_multi_attr ... FAILED(B
> test single_arg_flake_no_attr ... ok(B
> test single_arg_shell_no_attr ... ok(B
Turns out this particular thing was happening because on macos the nix sandbox is off by default.