Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions projects/bzl7/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_enable_proto_toolchain_resolution
build --incompatible_strict_action_env

build --host_cxxopt=-std=c++17

build --host_platform=@rules_nixpkgs_core//platforms:host

build:gcc10 --platforms=//platforms:gcc_10
Expand Down
16 changes: 16 additions & 0 deletions projects/bzl7/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
load("@gazelle//:def.bzl", "gazelle")
load("@rules_proto//proto/private/rules:proto_toolchain_rule.bzl", "proto_toolchain")

proto_toolchain(
name = "nixpkgs_protoc_toolchain",
proto_compiler = "@nixpkgs_protobuf//:bin/protoc",
visibility = ["//visibility:public"],
)

toolchain(
name = "nixpkgs_protobuf_toolchain",
toolchain_type = "@rules_proto//proto:toolchain_type",
exec_compatible_with = [
"@rules_nixpkgs_core//constraints:support_nix"
],
toolchain = ":nixpkgs_protoc_toolchain",
)

# gazelle:prefix github.com/Qarik-Group/disruptor/projects/bzl7
gazelle(
Expand Down
29 changes: 23 additions & 6 deletions projects/bzl7/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,38 @@ module(
name = "bzl7",
)

RULES_NIX_PKGS_VERSION = "0.11.1"
RULES_NIX_PKGS_VERSION = "928f28a41218fb81a3043facd7f8b7ce3294997c"

bazel_dep(name = "aspect_rules_py", version = "0.7.1")
bazel_dep(name = "gazelle", version = "0.36.0")
bazel_dep(name = "grpc", version = "1.62.1")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_go", version = "0.46.0")
bazel_dep(name = "rules_go", version = "0.50.1")
bazel_dep(name = "rules_nixpkgs_cc")
bazel_dep(name = "rules_nixpkgs_core", version = RULES_NIX_PKGS_VERSION)
bazel_dep(name = "rules_proto", version = "6.0.0-rc3")
bazel_dep(name = "rules_proto", version = "6.0.0")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "platforms", version = "0.0.9")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "protobuf", version = "26.0.bcr.1")

# fix for extra_flags_per_feature, not published yet to BCR
# https://github.com/tweag/rules_nixpkgs/commit/2e0ba5493bc07c40b365bd07334a6477754a6062
archive_override(
module_name = "rules_nixpkgs_core",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/{}.tar.gz".format(RULES_NIX_PKGS_VERSION)],
strip_prefix = "rules_nixpkgs-{}/core".format(RULES_NIX_PKGS_VERSION),
integrity = "sha256-R8WgrdWLsUyVwC/MjV2h86FKPjQ5bbAbOpiD7mQqn8U="
)

# Not yet available in the bazel central registry.
archive_override(
module_name = "rules_nixpkgs_cc",
urls = [
"https://github.com/tweag/rules_nixpkgs/releases/download/v{0}/rules_nixpkgs-{0}.tar.gz".format(RULES_NIX_PKGS_VERSION),
"https://github.com/tweag/rules_nixpkgs/archive/{}.tar.gz".format(RULES_NIX_PKGS_VERSION)
],
strip_prefix = "rules_nixpkgs-{}/toolchains/cc".format(RULES_NIX_PKGS_VERSION),
integrity = "sha256-KlVTSNf4WT/KK/P8bOU8XWKSnegbbCkuI/FsVXwK5Fo=",
integrity = "sha256-R8WgrdWLsUyVwC/MjV2h86FKPjQ5bbAbOpiD7mQqn8U="
)

nix_repo = use_extension("@rules_nixpkgs_core//extensions:repository.bzl", "nix_repo")
Expand Down Expand Up @@ -53,7 +63,12 @@ cc_library(
)
""",
)
use_repo(nix_pkg, "boost")
nix_pkg.attr(
name = "nixpkgs_protobuf",
attr = "protobuf",
repo = "@nixpkgs",
)
use_repo(nix_pkg, "boost", "nixpkgs_protobuf")

non_module_deps = use_extension("//toolchains:defs.bzl", "non_module_deps")
use_repo(
Expand Down Expand Up @@ -114,3 +129,5 @@ use_repo(
go_deps,
"org_golang_google_grpc",
)

register_toolchains("//:nixpkgs_protobuf_toolchain")
Loading