ldd
This commit is contained in:
50
overlays.nix
50
overlays.nix
@@ -259,6 +259,55 @@ let
|
||||
}
|
||||
);
|
||||
|
||||
# usage: nix-build ./dev.nix -A <package>.tests.checkLdd
|
||||
overlays.withTestCheckLdd = mkDerivationOverlay (
|
||||
final: prev: prevStdenv: finalAttrs: prevAttrs: {
|
||||
passthru = prevAttrs.passthru or { } // {
|
||||
tests = prevAttrs.tests or { } // {
|
||||
checkLdd =
|
||||
prev.runCommandLocal "${finalAttrs.finalPackage.name}-ldd"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
prev.fd
|
||||
];
|
||||
}
|
||||
''
|
||||
worker() (
|
||||
local output
|
||||
set +e
|
||||
output="$(ldd "$1")"
|
||||
if [[ $? -ne 0 ]] || grep <<<"$output" -q " not found"; then
|
||||
echo "$1"
|
||||
# TODO: show executable permission errors too
|
||||
grep <<<"$output" " not found"
|
||||
touch any_error
|
||||
fi
|
||||
)
|
||||
fd_args=(
|
||||
.
|
||||
${
|
||||
lib.pipe finalAttrs.finalPackage.outputs [
|
||||
(map (output: finalAttrs.finalPackage.${output}))
|
||||
lib.escapeShellArgs
|
||||
]
|
||||
}
|
||||
--type f
|
||||
--hidden
|
||||
--no-ignore
|
||||
--follow # symlinks
|
||||
-x bash -c "$(declare -f worker); worker \"\$@\""
|
||||
)
|
||||
fd "''${fd_args[@]}"
|
||||
|
||||
if [[ ! -e any_error ]]; then
|
||||
touch $out
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# TODO: this way of overriding does not work
|
||||
# Not a treewide enable, just for a single derivation
|
||||
# usage: nix-build . -A <package>.withCuda
|
||||
@@ -566,6 +615,7 @@ in
|
||||
overlays.withUnpacked
|
||||
overlays.withTestMainProgram
|
||||
overlays.withShellCheck
|
||||
overlays.withTestCheckLdd
|
||||
# overlays.withCudaOrRocm # WIP
|
||||
overlays.withCcache # WIP
|
||||
overlays.withTwostagePythonBuildPassthru
|
||||
|
||||
Reference in New Issue
Block a user