test(tvix/cli): eval nixpkgs.stdenv in CI and assert that it matches

Change-Id: If80194b5fdbf69512217bd4780e416e678045323
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8023
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2023-02-03 00:49:56 +03:00 committed by tazjin
parent 3419f63575
commit 0dd07440b4

View file

@ -1,5 +1,29 @@
{ depot, pkgs, lib, ... }:
depot.tvix.crates.workspaceMembers.tvix-cli.build.override {
(depot.tvix.crates.workspaceMembers.tvix-cli.build.override {
runTests = true;
}
}).overrideAttrs (_: {
meta = {
ci.extraSteps.eval-nixpkgs-stdenv = {
label = ":nix: evaluate nixpkgs.stdenv in tvix";
needsOutput = true;
command = pkgs.writeShellScript "tvix-eval-stdenv" ''
# Ensure tvix can find <nix/fetchurl.nix>
COREPKGS=$(${pkgs.nix}/bin/nix-instantiate --eval -E '<nix>')
export NIX_PATH="nix=''${COREPKGS}:''${NIX_PATH}"
TVIX_OUTPUT=$(result/bin/tvix -E '(import ${pkgs.path} {}).stdenv.drvPath')
EXPECTED='${/* the verbatim expected Tvix output: */ "=> \"${pkgs.stdenv.drvPath}\" :: string"}'
echo "Tvix output: ''${TVIX_OUTPUT}"
if [ "$TVIX_OUTPUT" != "$EXPECTED" ]; then
echo "Correct would have been ''${EXPECTED}"
exit 1
fi
echo "Output was correct."
'';
};
};
})