diff --git a/doc/release-notes/rl-2611.section.md b/doc/release-notes/rl-2611.section.md index 33cdf427dd32..eac21fb042d3 100644 --- a/doc/release-notes/rl-2611.section.md +++ b/doc/release-notes/rl-2611.section.md @@ -72,6 +72,8 @@ - `alps` has been rewritten upstream, see [upstream repository](https://github.com/migadu/alps) for documentation. +- `writers.makeDataWriter` has been removed. It has been deprecated since 2023. Use `pkgs.writeTextFile` instead. + - `bosun` has been removed as it is no longer maintained upstream. the corresponding monitoring options has been removed. - `uhttpmock` providing 0.0 ABI was removed. `uhttpmock_1_0` providing 1.0 ABI was renamed to `uhttpmock` and `uhttpmock_1_0` was kept as an alias. diff --git a/pkgs/build-support/writers/data.nix b/pkgs/build-support/writers/data.nix index c4a1876308d3..66d201f5a6b2 100644 --- a/pkgs/build-support/writers/data.nix +++ b/pkgs/build-support/writers/data.nix @@ -12,55 +12,7 @@ let ; in { - /** - Creates a transformer function that writes input data to disk, transformed - by both the `input` and `output` arguments. - - # Example - - ```nix - writeJSON = makeDataWriter { input = builtins.toJSON; output = "cp $inputPath $out"; }; - myConfig = writeJSON "config.json" { hello = "world"; } - ``` - - # Type - - ``` - makeDataWriter :: input -> output -> nameOrPath -> data -> (any -> string) -> string -> string -> any -> derivation - - input :: T -> string: function that takes the nix data and returns a string - output :: string: script that takes the $inputFile and write the result into $out - nameOrPath :: string: if the name contains a / the files gets written to a sub-folder of $out. The derivation name is the basename of this argument. - data :: T: the data that will be converted. - ``` - */ - makeDataWriter = lib.warn "pkgs.writers.makeDataWriter is deprecated. Use pkgs.writeTextFile." ( - { - input ? lib.id, - output ? "cp $inputPath $out", - }: - nameOrPath: data: - assert - (types.path.check nameOrPath) - || (builtins.match "([0-9A-Za-z._])[0-9A-Za-z._-]*" nameOrPath != null); - let - name = last (builtins.split "/" nameOrPath); - in - runCommand name - { - input = input data; - passAsFile = [ "input" ]; - } - '' - ${output} - - ${optionalString (types.path.check nameOrPath) '' - mv $out tmp - mkdir -p $out/$(dirname "${nameOrPath}") - mv tmp $out/${nameOrPath} - ''} - '' - ); + makeDataWriter = throw "pkgs.writers.makeDataWriter has been removed. Use pkgs.writeTextFile instead."; inherit (pkgs) writeText;