about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorIlan Joselevich <personal@ilanjoselevich.com>2024-06-05T18·03+0300
committerIlan Joselevich <personal@ilanjoselevich.com>2024-06-05T19·05+0000
commit9b77ce9f8facbb5018618738dc55f4f38c269a28 (patch)
treed13c02ec172ce38797a211dc58a996ce7e7eb45e /tvix
parent34d93f1d9611ca110d71ebf7430df646247270dc (diff)
fix(tvix/crate2nix-check): make drv less likely to be cached r/8219
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 <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix')
-rw-r--r--tvix/default.nix14
1 files changed, 7 insertions, 7 deletions
diff --git a/tvix/default.nix b/tvix/default.nix
index 9a362658c8d3..edcae8dd0795 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 = ''