From 9b77ce9f8facbb5018618738dc55f4f38c269a28 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Wed, 5 Jun 2024 21:03:10 +0300 Subject: [PATCH] fix(tvix/crate2nix-check): make drv less likely to be cached The derivation name for the check will now be calculated from the hash of all Cargo related files (including in subdirs), this makes it less likely for the drv to be cached and for CI to miss an outdated Cargo.lock. Change-Id: I900e9355be3f8a9d6f01162e8ef0da4d8901af30 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11753 Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/default.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tvix/default.nix b/tvix/default.nix index 9a362658c..edcae8dd0 100644 --- a/tvix/default.nix +++ b/tvix/default.nix @@ -185,13 +185,13 @@ in pkgs.stdenv.mkDerivation { inherit src; - # Important: we include the hash of the Cargo.lock file and - # Cargo.nix file in the derivation name. This forces the FOD - # to be rebuilt/reverified whenever either of them changes. - name = "tvix-crate2nix-check-" + - (builtins.substring 0 8 (builtins.hashFile "sha256" ./Cargo.lock)) + - "-" + - (builtins.substring 0 8 (builtins.hashFile "sha256" ./Cargo.nix)); + # Important: we include the hash of all Cargo related files in the derivation name. + # This forces the FOD to be rebuilt/re-verified whenever one of them changes. + name = "tvix-crate2nix-check-" + builtins.substring 0 8 (builtins.hashString "sha256" + (lib.concatMapStrings (f: builtins.hashFile "sha256" f) + ([ ./Cargo.toml ./Cargo.lock ] ++ (map (m: ./. + "/${m}/Cargo.toml") (lib.importTOML ./Cargo.toml).workspace.members)) + ) + ); nativeBuildInputs = with pkgs; [ git cacert cargo ]; buildPhase = ''