pkgs: add substituteSubset

This commit is contained in:
Infinidoge 2023-05-22 01:39:46 -04:00
parent a26f97d3f3
commit 3a4ab51731
2 changed files with 29 additions and 0 deletions

View file

@ -14,4 +14,6 @@ final: prev: {
sim65 = final.callPackage ./sim65.nix { };
unbted = final.callPackage ./unbted.nix { };
substituteSubset = final.callPackage ./substitute-subset.nix { };
}

View file

@ -0,0 +1,27 @@
{ 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=
cp -r "$src" "$out"
pushd "$out"
echo -ne "${lib.concatStringsSep "\\0" args.files}" | xargs -0 -n1 -I {} -- find {} -type f -print0 | while read -d "" line; do
substituteAllInPlace "$line"
done
popd
eval "$postInstall"
'';
preferLocalBuild = true;
allowSubstitutes = false;
} // args)