makeDataWriter
pkgs.writers.makeDataWriter
Functor
Docs pulled from | This Revision | 3 days ago
Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.
Noogle detected
This is a Functor
Learn about functors
Implementation
The following is the current implementation of this function.
{
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}
''}
''