Skip to content

Commit

Permalink
Merge pull request tweag#101 from tweag/platforms-repo
Browse files Browse the repository at this point in the history
Use platforms repo for constraints
  • Loading branch information
mboes authored Dec 30, 2019
2 parents c6dee7b + 74cb06e commit 81d8816
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).

[Unreleased]: https://github.com/tweag/rules_nixpkgs/compare/v0.6.0...HEAD

### Added

- Define `rules_nixpkgs_dependencies` in `//nixpkgs:repositories.bzl`.

## [0.6.0] - 2019-11-14

[0.6.0]: https://github.com/tweag/rules_nixpkgs/compare/v0.5.2...0.6.0
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ http_archive(
urls = ["https://github.com/tweag/rules_nixpkgs/archive/$COMMIT.tar.gz"],
)

load("@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl", "rules_nixpkgs_dependencies")
rules_nixpkgs_dependencies()

load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_git_repository", "nixpkgs_package")
```

Expand Down
4 changes: 4 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
workspace(name = "io_tweag_rules_nixpkgs")

load("//nixpkgs:repositories.bzl", "rules_nixpkgs_dependencies")

rules_nixpkgs_dependencies()

load(
"//nixpkgs:nixpkgs.bzl",
"nixpkgs_cc_configure",
Expand Down
8 changes: 4 additions & 4 deletions nixpkgs/constraints/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ constraint_value(
platform(
name = "linux_x86_64_nixpkgs",
constraint_values = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:linux",
"@platforms//cpu:x86_64",
"@platforms//os:linux",
":nixpkgs",
],
visibility = ["//visibility:public"],
Expand All @@ -17,8 +17,8 @@ platform(
platform(
name = "darwin_x86_64_nixpkgs",
constraint_values = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:osx",
"@platforms//cpu:x86_64",
"@platforms//os:osx",
":nixpkgs",
],
visibility = ["//visibility:public"],
Expand Down
16 changes: 8 additions & 8 deletions nixpkgs/nixpkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@ toolchain(
toolchain = ":py_runtime_pair",
toolchain_type = "@bazel_tools//tools/python:toolchain_type",
exec_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:{os}",
"@platforms//cpu:x86_64",
"@platforms//os:{os}",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs",
],
target_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:{os}",
"@platforms//cpu:x86_64",
"@platforms//os:{os}",
],
)
""".format(
Expand Down Expand Up @@ -505,13 +505,13 @@ toolchain(
toolchain = "@{workspace}//:nixpkgs_sh_posix",
toolchain_type = "@rules_sh//sh/posix:toolchain_type",
exec_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:{os}",
"@platforms//cpu:x86_64",
"@platforms//os:{os}",
"@io_tweag_rules_nixpkgs//nixpkgs/constraints:nixpkgs",
],
target_compatible_with = [
"@bazel_tools//platforms:x86_64",
"@bazel_tools//platforms:{os}",
"@platforms//cpu:x86_64",
"@platforms//os:{os}",
],
)
""".format(
Expand Down
12 changes: 12 additions & 0 deletions nixpkgs/repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

def rules_nixpkgs_dependencies():
"""Load repositories required by rules_nixpkgs."""
maybe(
http_archive,
"platforms",
sha256 = "23566db029006fe23d8140d14514ada8c742d82b51973b4d331ee423c75a0bfa",
strip_prefix = "platforms-46993efdd33b73649796c5fc5c9efb193ae19d51",
urls = ["https://github.com/bazelbuild/platforms/archive/46993efdd33b73649796c5fc5c9efb193ae19d51.tar.gz"],
)

0 comments on commit 81d8816

Please sign in to comment.