mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 15:11:35 +00:00
5c28152a95
trivial builder
27 lines
603 B
Nix
27 lines
603 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=
|
|
|
|
pushd "$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
|
|
popd
|
|
|
|
eval "$postInstall"
|
|
'';
|
|
preferLocalBuild = true;
|
|
allowSubstitutes = false;
|
|
} // args)
|