writeText
pkgs.writers.writeText
Functor
Docs pulled from | This Revision | 11 minutes ago
Noogle detected
This is a Functor
Learn about functors
Implementation
The following is the current implementation of this function.
writeText = name: text:
# TODO: To fully deprecate, replace the assertion with `lib.isString` and remove the warning
assert lib.assertMsg (lib.strings.isConvertibleWithToString text) ''
pkgs.writeText ${lib.strings.escapeNixString name}: The second argument should be a string, but it's a ${builtins.typeOf text} instead.'';
lib.warnIf (! lib.isString text) ''
pkgs.writeText ${lib.strings.escapeNixString name}: The second argument should be a string, but it's a ${builtins.typeOf text} instead, which is deprecated. Use `toString` to convert the value to a string first.''
writeTextFile { inherit name text; };