jeez. it works
This commit is contained in:
parent
6a07d90f6f
commit
19e73e9aab
20
package.nix
20
package.nix
|
@ -5,17 +5,29 @@
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
pkgList,
|
pkgList,
|
||||||
fileGlobs ? [ "bin/*" "lib/*"],
|
fileGlobs ? [ "bin/*" "lib/*.so.*"],
|
||||||
fileFindPredicates ? "-type f",
|
fileFindPredicates ? "-type f",
|
||||||
pkgProcessor ? pkg: pkg,
|
pkgProcessor ? pkg: pkg,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
processedList = map pkgProcessor pkgList;
|
processedList = map pkgProcessor pkgList;
|
||||||
globPredicates = lib.concatMapStringsSep " " (g: "-find ${g}") fileGlobs;
|
globPredicates = lib.concatMapStringsSep " -or " (g: "-path \"./${lib.strings.removePrefix "/" g}\"") fileGlobs;
|
||||||
copiedBins = runCommand name {} ''
|
copiedBins = runCommand name {} ''
|
||||||
mkdir -p $out/bins
|
mkdir -p $out/bins
|
||||||
find ${lib.concatStringsSep " " processedList} ${globPredicates} ${fileFindPredicates}| while read -r filepath; do
|
for pkgPath in ${lib.concatStringsSep " " processedList}; do
|
||||||
cp "$filepath" $out/bins
|
cd $pkgPath
|
||||||
|
find . \( ${globPredicates} \) ${fileFindPredicates} | while read -r filename; do
|
||||||
|
fullPath="$pkgPath/$filename"
|
||||||
|
destPath="$out/bins/$(basename $filename)"
|
||||||
|
if [[ $(head -c 4 "$fullPath") != $'\x7fELF' ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ -e "$destPath" ]]; then
|
||||||
|
echo "Uh oh: conflict for populating $destPath from $fullPath"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cp $fullPath $out/bins
|
||||||
|
done
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
in copiedBins
|
in copiedBins
|
||||||
|
|
Loading…
Reference in New Issue