git.iko.soy/typeable/nixpkgs
on master help sign in
substituteAllFiles: add derivation

Closes #4145

commit09f33a43896fd4baaf3eaa299e6e1e1d5944d3a2 authorNikolay Amiantov <ab@fmap.me> dateMon 6 Oct 2014, 18:28 (12 years ago) parent9e74259
2 files changed+26
pkgs/build-support/substitute-files/substitute-all-files.nix+22 pkgs/top-level/all-packages.nix+4
pkgs/build-support/substitute-files/substitute-all-files.nixnew file+22
@@ -0,0 +1,22 @@
1+{ stdenv }:
2+
3+args:
4+
5+stdenv.mkDerivation ({
6+ name = if args ? name then args.name else baseNameOf (toString args.src);
7+ builder = with stdenv.lib; builtins.toFile "builder.sh" ''
8+ source $stdenv/setup
9+ set -o pipefail
10+
11+ eval "$preInstall"
12+
13+ args=
14+
15+ cd "$src"
16+ echo -ne "${concatStringsSep "\\0" args.files}" | xargs -0 -n1 -I {} -- find {} -type f -print0 | while read -d "" line; do
17+ mkdir -p "$out/$(dirname "$line")"
18+ substituteAll "$line" "$out/$line"
19+ done
20+ '';
21+ preferLocalBuild = true;
22+} // args)
pkgs/top-level/all-packages.nix+4
@@ -401,6 +401,10 @@ let
401401 inherit stdenv;
402402 };
403403
404+ substituteAllFiles = import ../build-support/substitute-files/substitute-all-files.nix {
405+ inherit stdenv;
406+ };
407+
404408 replaceDependency = import ../build-support/replace-dependency.nix {
405409 inherit runCommand nix lib;
406410 };