Unverified Commit 7eef49b5 authored by Thomas Tuegel's avatar Thomas Tuegel Committed by GitHub
Browse files

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

parents c4deabee 93561e67
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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
          }