git.iko.soy/typeable/nixpkgs
on master help sign in
bazel: add python to the runtime closure
commit25cd44063fd1e4cfe7e44300441a2bd0a254cd48 authorPhilip Patsch <philip.patsch@tweag.io> dateTue 22 Jan 2019, 16:42 (8 years ago) parent6ad1271
1 file changed+6−1
pkgs/development/tools/build-managers/bazel/default.nix+6−1
pkgs/development/tools/build-managers/bazel/default.nix+6−1
@@ -125,9 +125,11 @@ stdenv.mkDerivation rec {
125125
126126 genericPatches = ''
127127 # Substitute python's stub shebang to plain python path. (see TODO add pr URL)
128+ # See also `postFixup` where python is added to $out/nix-support
128129 substituteInPlace src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt\
129130 --replace "/usr/bin/env python" "${python}/bin/python" \
130131 --replace "NIX_STORE_PYTHON_PATH" "${python}/bin/python" \
132+
131133 # substituteInPlace is rather slow, so prefilter the files with grep
132134 grep -rlZ /bin src/main/java/com/google/devtools | while IFS="" read -r -d "" path; do
133135 # If you add more replacements here, you must change the grep above!
@@ -262,7 +264,10 @@ stdenv.mkDerivation rec {
262264 # Save paths to hardcoded dependencies so Nix can detect them.
263265 postFixup = ''
264266 mkdir -p $out/nix-support
265− echo "${customBash} ${defaultShellPath}" > $out/nix-support/depends
267+ echo "${customBash} ${defaultShellPath}" >> $out/nix-support/depends
268+ # The templates get tar’d up into a .jar,
269+ # so nix can’t detect python is needed in the runtime closure
270+ echo "${python}" >> $out/nix-support/depends
266271 '';
267272
268273 dontStrip = true;