Skip to content

Commit

Permalink
Enable a nixpkgs imported Java runtime
Browse files Browse the repository at this point in the history
We use JDK 8 because the nixpkgs version 18.09 does not provide Java 11
yet and Java 9 and 10 cause problems with Bazel 4.0.0 and are no longer
supported releases. See
- bazelbuild/bazel#8750 (comment)
- bazelbuild/bazel#13065
  • Loading branch information
aherrmann committed Dec 10, 2021
1 parent b3d8024 commit af57cae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host

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
Expand Down
10 changes: 10 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rules_nixpkgs_dependencies()
load(
"//nixpkgs:nixpkgs.bzl",
"nixpkgs_cc_configure",
"nixpkgs_java_configure",
"nixpkgs_git_repository",
"nixpkgs_local_repository",
"nixpkgs_package",
Expand Down Expand Up @@ -185,6 +186,15 @@ nixpkgs_cc_configure(
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",
)

nixpkgs_python_configure(
python2_attribute_path = "python2",
repository = "@remote_nixpkgs",
Expand Down

0 comments on commit af57cae

Please sign in to comment.