diff --git a/core/.bazelrc b/core/.bazelrc new file mode 100644 index 000000000..6634f6729 --- /dev/null +++ b/core/.bazelrc @@ -0,0 +1,35 @@ +build --host_platform=@rules_nixpkgs_core//platforms:host + +# NOTE: all of the following is copy-pasted from `/.bazelrc` and necessary to +# make this repository work compatibly in isolation. + +build --crosstool_top=@nixpkgs_config_cc//:toolchain +# Using toolchain resolution can lead to spurious dependencies on +# `@local_config_cc//:builtin_include_directory_paths`. This needs to be +# resolved before `--incompatible_enable_cc_toolchain_resolution` can be +# recommended for `nixpkgs_cc_configure_hermetic`. +# build --incompatible_enable_cc_toolchain_resolution + +build --javabase=@nixpkgs_java_runtime//:runtime +build --host_javabase=@nixpkgs_java_runtime//:runtime +build --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 +build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 + +# CI Configuration +# ---------------- +common:ci --color=no +build:ci --verbose_failures +test:ci --test_output=errors + +# Use a remote cache during CI +build:ci --bes_results_url=https://app.buildbuddy.io/invocation/ +build:ci --bes_backend=grpcs://cloud.buildbuddy.io +build:ci --remote_cache=grpcs://cloud.buildbuddy.io +build:ci --remote_timeout=3600 +# Avoid failures of the form `deadline exceeded after 14999958197ns DEADLINE_EXCEEDED`. +# See https://github.com/tweag/rules_haskell/issues/1498. +build:ci --keep_backend_build_event_connections_alive=false + +# User Configuration +# ------------------ +try-import %workspace%/.bazelrc.local diff --git a/core/WORKSPACE b/core/WORKSPACE index a69f72f2c..2b94cdc55 100644 --- a/core/WORKSPACE +++ b/core/WORKSPACE @@ -1,2 +1,63 @@ -# only temporary for compatibility with `WORKSPACE` setup -# TODO: remove when migration to `bzlmod` is complete \ No newline at end of file +# NOTE: only temporary for compatibility with `WORKSPACE` setup! +# TODO: remove when migration to `bzlmod` is complete + + +# NOTE: all of the following is copy-pasted from `/WORKSPACE` and reduced +# to the necessary to make this repository work compatibly in isolation. + +# TODO: remove dependency on cumulative repository to be sure there is no +# hidden entanglement left. use individual toolchains instead. +local_repository( + name = "io_tweag_rules_nixpkgs", + path = "..", +) + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl", "rules_nixpkgs_dependencies") + +rules_nixpkgs_dependencies() + +load("//:nixpkgs.bzl", "nixpkgs_git_repository", "nixpkgs_local_repository") +load("@rules_nixpkgs_cc//:cc.bzl", "nixpkgs_cc_configure") +load("@rules_nixpkgs_java//:java.bzl", "nixpkgs_java_configure") + +http_archive( + name = "io_bazel_stardoc", + sha256 = "6d07d18c15abb0f6d393adbd6075cd661a2219faab56a9517741f0fc755f6f3c", + strip_prefix = "stardoc-0.4.0", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/stardoc/archive/0.4.0.tar.gz", + "https://github.com/bazelbuild/stardoc/archive/0.4.0.tar.gz", + ], +) + +load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories") + +stardoc_repositories() + +nixpkgs_git_repository( + name = "remote_nixpkgs", + remote = "https://github.com/NixOS/nixpkgs", + revision = "21.11", + sha256 = "c77bb41cf5dd82f4718fa789d49363f512bb6fa6bc25f8d60902fe2d698ed7cc", +) + +nixpkgs_local_repository( + name = "nixpkgs", + nix_file = "@io_tweag_rules_nixpkgs//:nixpkgs.nix", + nix_file_deps = ["@io_tweag_rules_nixpkgs//:nixpkgs.json"], +) + +nixpkgs_cc_configure( + name = "nixpkgs_config_cc", + repository = "@remote_nixpkgs", +) + +load("@rules_java//java:repositories.bzl", "rules_java_dependencies") + +rules_java_dependencies() + +nixpkgs_java_configure( + attribute_path = "jdk8.home", + repository = "@remote_nixpkgs", +)