1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 05:31:22 +00:00
nixpkgs/pkgs/build-support/substitute-files/substitute-all-files.nix
2014-10-16 15:27:25 +01:00

23 lines
538 B
Nix

{ stdenv }:
args:
stdenv.mkDerivation ({
name = if args ? name then args.name else baseNameOf (toString args.src);
builder = with stdenv.lib; builtins.toFile "builder.sh" ''
source $stdenv/setup
set -o pipefail
eval "$preInstall"
args=
cd "$src"
echo -ne "${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
'';
preferLocalBuild = true;
} // args)