diff options
Diffstat (limited to 'nixpkgs/pkgs/build-support/substitute-files/substitute-all-files.nix')
-rw-r--r-- | nixpkgs/pkgs/build-support/substitute-files/substitute-all-files.nix | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/substitute-files/substitute-all-files.nix b/nixpkgs/pkgs/build-support/substitute-files/substitute-all-files.nix new file mode 100644 index 000000000000..682e976dcfe5 --- /dev/null +++ b/nixpkgs/pkgs/build-support/substitute-files/substitute-all-files.nix @@ -0,0 +1,26 @@ +{ lib, stdenv }: + +args: + +stdenv.mkDerivation ({ + name = if args ? name then args.name else baseNameOf (toString args.src); + builder = builtins.toFile "builder.sh" '' + source $stdenv/setup + set -o pipefail + + eval "$preInstall" + + args= + + pushd "$src" + echo -ne "${lib.concatStringsSep "\\0" args.files}" | xargs -0 -n1 -I {} -- find {} -type f -print0 | while read -d "" line; do + mkdir -p "$out/$(dirname "$line")" + substituteAll "$line" "$out/$line" + done + popd + + eval "$postInstall" + ''; + preferLocalBuild = true; + allowSubstitutes = false; +} // args) |