1 cargoInstallPostBuildHook
() {
2 echo "Executing cargoInstallPostBuildHook"
4 releaseDir
=target
/@targetSubdirectory@
/$cargoBuildType
5 tmpDir
="${releaseDir}-tmp";
8 cp -r ${releaseDir}/* $tmpDir/
12 -executable ! \
( -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \
))
14 echo "Finished cargoInstallPostBuildHook"
18 echo "Executing cargoInstallHook"
22 # rename the output dir to a architecture independent one
24 releaseDir
=target
/@targetSubdirectory@
/$cargoBuildType
25 tmpDir
="${releaseDir}-tmp";
27 mapfile
-t targets
< <(find "$NIX_BUILD_TOP" -type d |
grep "${tmpDir}$")
28 for target
in "${targets[@]}"; do
29 rm -rf "$target/../../${cargoBuildType}"
30 ln -srf "$target" "$target/../../"
32 mkdir
-p $out/bin
$out/lib
34 xargs -r cp -t $out/bin
<<< $bins
37 -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \
38 -print0 |
xargs -r -0 cp -t $out/lib
40 # If present, copy any .dSYM directories for debugging on darwin
41 # https://github.com/NixOS/nixpkgs/issues/330036
42 find "${releaseDir}" -maxdepth 1 -name '*.dSYM' -exec cp -RLt $out/bin
/ {} +
44 rmdir --ignore-fail-on-non-empty $out/lib
$out/bin
47 echo "Finished cargoInstallHook"
51 if [ -z "${dontCargoInstall-}" ] && [ -z "${installPhase-}" ]; then
52 installPhase
=cargoInstallHook
53 postBuildHooks
+=(cargoInstallPostBuildHook
)