How to format 'nix eval' output with «» - double angle quotation marks

Hello, I am having difficulties in the way of debugging nix config.

For nix eval, --json isn’t applicable for outputs that contain functions (error: cannot convert a function to JSON). So manually piping to nixfmt is an option, but nixfmt can’t handle «» ( guillemets/double angle quotation marks). I tried using a simple to string conversion sed --null-data -E 's/«([^»]*?)»/"«\1»"/g' | nixfmt, but then nested guillemets (««»») stop it.

For example:

nix eval github:nix-community/emacs-overlay#overlay 
# => «lambda default @ «github:nix-community/emacs-overlay/74cb2e9f130bba564295453b8a19eef53af202c5»/flake.nix:53:19»

None of that is a nix expression so nixfmt can’t format it (nor should you need to format that).

Instead, it’s a file position within a flake, following it gets you here: