diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 15fc47c8a..cd692a14d 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -64,8 +64,6 @@ jobs: without_nix=( cc go rust ) if [ "${{ runner.os }}" == "macOS" ]; then - # Python - https://github.com/tweag/rules_nixpkgs/issues/186 - skip with_nix python # Rust - https://github.com/tweag/rules_nixpkgs/issues/187 skip with_nix rust skip without_nix rust diff --git a/nixpkgs/nixpkgs.bzl b/nixpkgs/nixpkgs.bzl index 41ec69f58..94233b784 100644 --- a/nixpkgs/nixpkgs.bzl +++ b/nixpkgs/nixpkgs.bzl @@ -1057,16 +1057,15 @@ _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( - attribute_path = attribute_path, - bin_path = bin_path, - ) - else: - stub_shebang = "" + add_shebang = versions.is_at_least("4.2.0", versions.get()) return """ with import {{ config = {{}}; overlays = []; }}; +let + addShebang = {add_shebang}; + interpreterPath = "${{{attribute_path}}}/{bin_path}"; + shebangLine = interpreter: writers.makeScriptWriter {{ inherit interpreter; }} "shebang" ""; +in runCommand "bazel-nixpkgs-python-toolchain" {{ executable = false; # Pointless to do this on a remote machine. @@ -1080,17 +1079,19 @@ runCommand "bazel-nixpkgs-python-toolchain" cat >>$n <