TIL that in Nix, if you have a multi-line string of code, you can simply prefix it with a comment stating the name of the language and Tree-sitter will highlight it for you!
{
# The TOML string below will be highlighted!
programs.foo.extraConfig = /* toml */ ''
bar = "baz"
'';
}