Skip to content

Commit

Permalink
Work around Bazel toolchain constraint issue
Browse files Browse the repository at this point in the history
Toolchain resolution of the Python toolchain erroneously picked the
autodetecting toolchain instead of the nixpkgs provided toolchain.
Debugging with `--toolchain_resolution_debug` shows the following error:

```
Toolchain constraint @bazel_tools//tools/cpp:cc_compiler has value //nixpkgs/constraints:nixpkgs, which does not match value @io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs from the execution platform @io_tweag_rules_nixpkgs//nixpkgs/constraints:linux_x86_64_nixpkgs
```

The issue is that Bazel (tested at version 2.1) considers
`//nixpkgs/constraints:nixpkgs` and
`@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs` two different
values, even though they refer to the same target.
  • Loading branch information
aherrmann authored and Théophane Hufschmitt committed Mar 9, 2020
1 parent e94062c commit 115cd6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nixpkgs/constraints/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ platform(
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
":nixpkgs",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs",
],
visibility = ["//visibility:public"],
)
Expand All @@ -19,7 +19,7 @@ platform(
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:osx",
":nixpkgs",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs",
],
visibility = ["//visibility:public"],
)

0 comments on commit 115cd6d

Please sign in to comment.