You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rules_python's python_register_toolchains has an interpreter target in its toolchains. Repository rules cannot access toolchains like regular rules can, and they use that target to ensure they're using the same interpreter as the toolchain.
Worth noting, the current setup doesn't generate an executable file within Bazel's execroot, instead it points directly into the Nix store, see here for the reasoning behind that. That said, creating a single bin/python symlink shouldn't be an issue.
Another thing worth noting, rules_nixpkgs provided toolchains are very careful to separate the external workspace that defines the toolchain from the external workspace(s) that hold the actual Nix imports. This is to ensure that the Nix dependencies are fetched lazily, and to support non-Nix use-cases (e.g. Windows). So, as proposed by @uri-canva, the interpreter target and the bin/python symlink probably have to sit within the workspace that defines the py_runtime target. That said, it should be possible for _nixpkgs_python_toolchain to generate a defs.bzl file that exports an interpreter like rules_python does.
rules_python
'spython_register_toolchains
has aninterpreter
target in its toolchains. Repository rules cannot access toolchains like regular rules can, and they use that target to ensure they're using the same interpreter as the toolchain.See https://github.com/bazelbuild/rules_python/blob/9cdb4f3f6aded1ccc62a10d004f9927ccc72702f/README.md#toolchain-registration for example.
It would be good if
nixpkgs_python_configure
did the same thing here:rules_nixpkgs/toolchains/python/python.bzl
Line 80 in 9f08fb2
build_file_content
tonixpkgs_package
:Repository rules of other language ecosystems have the same issue, but they don't seem to have a similar pattern (for example
rules_jvm_external
doesn't provide any way of specifying which java runtime to use other than the regularPATH
/JAVA_HOME
: https://github.com/bazelbuild/rules_jvm_external/blob/3957fdc382b5a404fccdde74b91c1e614e07e6bd/coursier.bzl#L206.The text was updated successfully, but these errors were encountered: