From 4b6291b362ed69a99ea1817b185ec412ae265a4b Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Mon, 21 Feb 2022 17:37:20 +0400 Subject: [PATCH] Add bash to #! line for python wrapper in nixpkgs Replicate NixOS/nixpkgs#93757 for Bazel generated script. Fixes #186 --- nixpkgs/nixpkgs.bzl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nixpkgs/nixpkgs.bzl b/nixpkgs/nixpkgs.bzl index 061170e6..a96edd91 100644 --- a/nixpkgs/nixpkgs.bzl +++ b/nixpkgs/nixpkgs.bzl @@ -1054,7 +1054,9 @@ _nixpkgs_python_toolchain = repository_rule( def _python_nix_file_content(attribute_path, bin_path, version): if versions.is_at_least("4.2.0", versions.get()): - stub_shebang = """stub_shebang = "#!${{{attribute_path}}}/{bin_path}",""".format( + # Include bash path to the shebang to avoid problems on macOS + # see https://github.com/NixOS/nixpkgs/pull/93757 + stub_shebang = """stub_shebang = "#!${{({attribute_path}).stdenv.shell}} ${{{attribute_path}}}/{bin_path}",""".format( attribute_path = attribute_path, bin_path = bin_path, )