substituteAllFiles: add derivation

Closes #4145
This commit is contained in:
Nikolay Amiantov 2014-10-06 18:28:32 +04:00 committed by Mateusz Kowalczyk
parent 9e74259bbe
commit 09f33a4389
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,22 @@
{ 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)

View File

@ -401,6 +401,10 @@ let
inherit stdenv;
};
substituteAllFiles = import ../build-support/substitute-files/substitute-all-files.nix {
inherit stdenv;
};
replaceDependency = import ../build-support/replace-dependency.nix {
inherit runCommand nix lib;
};