@@ -4,10 +4,30 @@
44, lib
55}:
66
7−args@{ name, bazelFlags ? [], bazelBuildFlags ? [], bazelFetchFlags ? [], bazelTarget, buildAttrs, fetchAttrs, ... }:
7+args@{
8+ name
9+, bazelFlags ? []
10+, bazelBuildFlags ? []
11+, bazelFetchFlags ? []
12+, bazelTarget
13+, buildAttrs
14+, fetchAttrs
15+
16+# Newer versions of Bazel are moving away from built-in rules_cc and instead
17+# allow fetching it as an external dependency in a WORKSPACE file[1]. If
18+# removed in the fixed-output fetch phase, building will fail to download it.
19+# This can be seen e.g. in #73097
20+#
21+# This option allows configuring the removal of rules_cc in cases where a
22+# project depends on it via an external dependency.
23+#
24+# [1]: https://github.com/bazelbuild/rules_cc
25+, removeRulesCC ? true
26+, ...
27+}:
828
929let
10− fArgs = removeAttrs args [ "buildAttrs" "fetchAttrs" ];
30+ fArgs = removeAttrs args [ "buildAttrs" "fetchAttrs" "removeRulesCC" ];
1131 fBuildAttrs = fArgs // buildAttrs;
1232 fFetchAttrs = fArgs // removeAttrs fetchAttrs [ "sha256" ];
1333
@@ -60,7 +80,7 @@ in stdenv.mkDerivation (fBuildAttrs // {
6080
6181 # Remove all built in external workspaces, Bazel will recreate them when building
6282 rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker}
63− rm -rf $bazelOut/external/{rules_cc,\@rules_cc.marker}
83+ ${if removeRulesCC then "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}" else ""}
6484 rm -rf $bazelOut/external/{embedded_jdk,\@embedded_jdk.marker}
6585 rm -rf $bazelOut/external/{local_*,\@local_*.marker}
6686