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 <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Ilan Joselevich 2024-06-05 21:03:10 +03:00
parent 34d93f1d96
commit 9b77ce9f8f

View file

@ -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 = ''