From f0fb522133cf3038ced936bbbd00dc514510ce29 Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Mon, 18 May 2020 12:14:40 +0200 Subject: [PATCH] Use hermetic toolchain in compatibility workspace --- compatibility/WORKSPACE | 11 +++++++---- compatibility/deps.bzl | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/compatibility/WORKSPACE b/compatibility/WORKSPACE index 5c9f787e53f8..0862f2a7e405 100644 --- a/compatibility/WORKSPACE +++ b/compatibility/WORKSPACE @@ -44,7 +44,7 @@ load( ) load( "@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", - "nixpkgs_cc_configure", + "nixpkgs_cc_configure_hermetic", "nixpkgs_local_repository", "nixpkgs_package", "nixpkgs_python_configure", @@ -78,14 +78,17 @@ nixpkgs_local_repository( ], ) -nixpkgs_cc_configure( +nixpkgs_cc_configure_hermetic( + # We override the Bazel's autodetect toolchain to avoid accidentaly + # dependencies on the inhermetic autodetected builtin include paths or + # builds failing due to Bazel not finding `cc` in `$PATH` or `$CC`. + name = "local_config_cc", nix_file = "@daml//nix:bazel-cc-toolchain.nix", nix_file_deps = common_nix_file_deps + [ - "@daml//nix:bazel-cc-toolchain.nix", "@daml//nix:tools/bazel-cc-toolchain/default.nix", ], repositories = dev_env_nix_repos, -) +) if not is_windows else None nixpkgs_package( name = "glibc_locales", diff --git a/compatibility/deps.bzl b/compatibility/deps.bzl index fa0757e0e25f..109c6a6c4c9b 100644 --- a/compatibility/deps.bzl +++ b/compatibility/deps.bzl @@ -64,6 +64,12 @@ def daml_deps(): strip_prefix = "rules_nixpkgs-%s" % rules_nixpkgs_version, urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version], sha256 = rules_nixpkgs_sha256, + patches = [ + # Remove once https://github.com/tweag/rules_nixpkgs/pull/128 + # has been merged + "@daml//bazel_tools:nixpkgs-hermetic-cc-toolchain.patch", + ], + patch_args = ["-p1"], ) if "com_github_bazelbuild_buildtools" not in native.existing_rules():