emacs/wrapper.nix: link included executables by their resolved paths (#395705)

This commit is contained in:
Thomas Tuegel
2025-10-27 17:54:34 -05:00
committed by GitHub
@@ -125,9 +125,19 @@ runCommand (lib.appendToName "with-packages" emacs).name
local origin_path=$2
local dest_path=$3
# Add the path to the search path list, but only if it exists
# Add the path to the search path list, but only if it exists.
# Executables in /bin are linked by their resolved paths in case they are
# relative symlinks (which break when 'lndir'ed as is);
# see https://github.com/NixOS/nixpkgs/issues/395442
if [[ -d "$pkg/$origin_path" ]]; then
$lndir/bin/lndir -silent "$pkg/$origin_path" "$out/$dest_path"
case "$origin_path" in
bin)
for exe in $pkg/$origin_path/*; do
ln -s "$(realpath "$exe")" "$out/$dest_path/$(basename "$exe")"
done
;;
*) $lndir/bin/lndir -silent "$pkg/$origin_path" "$out/$dest_path";;
esac
fi
}