query
On this page

writeText

pkgs.writeText

Docs pulled from | This Revision | 10 minutes ago


or https://nixos.org/manual/nixpkgs/unstable/#trivial-builder-text-writing


Noogle detected

Aliases

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; };