Skip to content

Commit

Permalink
Introduce new nix constraint setting
Browse files Browse the repository at this point in the history
Platforms supporting Nix previously used the
`//nixpkgs/constraints:nixpkgs` constraint value. However, this
constraint value is associated to a bizarre constraint setting:
`@bazel_tools//tools/cpp:cc_compiler`. A better option is to define
a new `constraint_setting`, with a single `constraint_value`, in the
style of bazelbuild/bazel-toolchains.

Deprecates `//nixpkgs/constraints:nixpkgs`.

Closes tweag#121
  • Loading branch information
mboes authored and mergify-bot committed Apr 20, 2020
1 parent 1050cbc commit 09246d7
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion nixpkgs/constraints/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package(default_visibility = ["//visibility:public"])

constraint_setting(name = "nix")

constraint_value(
name = "support_nix",
constraint_setting = ":nix",
)

constraint_value(
name = "nixpkgs",
constraint_setting = "@bazel_tools//tools/cpp:cc_compiler",
visibility = ["//visibility:public"],
deprecation = "Use support_nix constraint value instead.",
)

platform(
6 changes: 3 additions & 3 deletions nixpkgs/nixpkgs.bzl
Original file line number Diff line number Diff line change
@@ -350,7 +350,7 @@ toolchain(
exec_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:{os}",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:support_nix",
],
target_compatible_with = [
"@platforms//cpu:x86_64",
@@ -413,7 +413,7 @@ def nixpkgs_python_configure(
Creates `nixpkgs_package`s for Python 2 or 3 `py_runtime` instances and a
corresponding `py_runtime_pair` and `toolchain`. The toolchain is
automatically registered and uses the constraint:
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs"
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:support_nix"
Attrs:
name: The name-prefix for the created external repositories.
@@ -533,7 +533,7 @@ toolchain(
exec_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:{os}",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:support_nix",
],
target_compatible_with = [
"@platforms//cpu:x86_64",

0 comments on commit 09246d7

Please sign in to comment.