From eda51e3ea844f7a341b2e198608c38588479ad93 Mon Sep 17 00:00:00 2001 From: Graham Bennett Date: Thu, 20 Jan 2022 21:04:58 +0000 Subject: [PATCH] bazel_3, bazel_4: Explicitly add a dependency on bazel-rc This resolves an issue where the path to the bazel-rc file is sometimes optimised so the full hash is not present, and hence not picked up by the scan as a runtime dependency. --- .../tools/build-managers/bazel/bazel_3/default.nix | 4 ++++ .../tools/build-managers/bazel/bazel_4/default.nix | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix index d9c93c2265f5..3c71c8cc0891 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix @@ -613,6 +613,10 @@ stdenv.mkDerivation rec { # runtime dependencies. echo "${python27}" >> $out/nix-support/depends echo "${python3}" >> $out/nix-support/depends + # The string literal specifying the path to the bazel-rc file is sometimes + # stored non-contiguously in the binary due to gcc optimisations, which leads + # Nix to miss the hash when scanning for dependencies + echo "${bazelRC}" >> $out/nix-support/depends '' + lib.optionalString stdenv.isDarwin '' echo "${cctools}" >> $out/nix-support/depends ''; diff --git a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix index 6a8792910b11..72c971d1334d 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix @@ -660,6 +660,10 @@ stdenv.mkDerivation rec { postFixup = '' mkdir -p $out/nix-support echo "${defaultShellPath}" >> $out/nix-support/depends + # The string literal specifying the path to the bazel-rc file is sometimes + # stored non-contiguously in the binary due to gcc optimisations, which leads + # Nix to miss the hash when scanning for dependencies + echo "${bazelRC}" >> $out/nix-support/depends '' + lib.optionalString stdenv.isDarwin '' echo "${cctools}" >> $out/nix-support/depends '';