Skip to content

Commit

Permalink
Fix emacsWithPackages after 7f3ca3e.
Browse files Browse the repository at this point in the history
This is hacky but it does the job, resurrects findInputs from before staging merge
  • Loading branch information
shlevy committed Jan 4, 2018
1 parent 1b0f696 commit 0f92594
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion pkgs/build-support/emacs/wrapper.nix
Expand Up @@ -55,12 +55,46 @@ stdenv.mkDerivation {
deps = runCommand "emacs-packages-deps"
{ inherit explicitRequires lndir emacs; }
''
findInputsOld() {
local pkg="$1"; shift
local var="$1"; shift
local propagatedBuildInputsFiles=("$@")
# TODO(@Ericson2314): Restore using associative array once Darwin
# nix-shell doesn't use impure bash. This should replace the O(n)
# case with an O(1) hash map lookup, assuming bash is implemented
# well :D.
local varSlice="$var[*]"
# ''${..-} to hack around old bash empty array problem
case "''${!varSlice-}" in
*" $pkg "*) return 0 ;;
esac
unset -v varSlice
eval "$var"'+=("$pkg")'
if ! [ -e "$pkg" ]; then
echo "build input $pkg does not exist" >&2
exit 1
fi
local file
for file in "''${propagatedBuildInputsFiles[@]}"; do
file="$pkg/nix-support/$file"
[[ -f "$file" ]] || continue
local pkgNext
for pkgNext in $(< "$file"); do
findInputsOld "$pkgNext" "$var" "''${propagatedBuildInputsFiles[@]}"
done
done
}
mkdir -p $out/bin
mkdir -p $out/share/emacs/site-lisp
local requires
for pkg in $explicitRequires; do
findInputs $pkg requires propagated-user-env-packages
findInputsOld $pkg requires propagated-user-env-packages
done
# requires now holds all requested packages and their transitive dependencies
Expand Down

0 comments on commit 0f92594

Please sign in to comment.