Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to access the output_path in generated BUILD files #601

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/nixpkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def _nixpkgs_build_and_symlink(repository_ctx, nix_build_cmd, expr_args, build_f
# provided by `build_file` or `build_file_content`.
if not repository_ctx.path("BUILD").exists and not repository_ctx.path("BUILD.bazel").exists:
if build_file_content:
repository_ctx.file("BUILD", content = build_file_content)
repository_ctx.file("BUILD", content = build_file_content.replace("{{NIX_STORE_PATH}}", output_path))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, that could potentially have simplified things like the Python toolchain.

I guess the same could be done with the build_file attribute using repository_ctx.template for consistency.

This behavior should also be documented in the relevant repo macros / module extension tags.

else:
repository_ctx.template("BUILD", Label("@rules_nixpkgs_core//:BUILD.bazel.tpl"))
elif build_file_content:
Expand Down
Loading