Need help understanding how to escape special characters in the list of str type

As long as it resolves to a string on eval you can put any expression in parens, and you can import external text files like so:

[
  (builtins.readFile ./config.exs)
  # or using interpolation to blend strings with code
  ''
    some import string content
    ${lib.fileContents ./other.txt}
  ''
]

builtins.readFile adds an extra newline at the end of the file, if you need to avoid this you can use lib.fileContents from nixpkgs instead.

2 Likes