These functions write text
to a file within the Nix store. This is useful for creating files from Nix expressions, which may be scripts or just non-executable text files, depending on the function used and its arguments.
writeTextFile
takes an attribute set and expects two arguments, name
and text
. name
corresponds to the name used in the Nix store path. text
will be the contents of the file. You can also set executable
to true to make this file have the executable bit set.
Many more commands wrap writeTextFile
including writeText
, writeTextDir
, writeScript
, and writeScriptBin
. These are convenience functions over writeTextFile
.
Here are a few examples: