diff options
Diffstat (limited to 'tvix/cli')
-rw-r--r-- | tvix/cli/default.nix | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/tvix/cli/default.nix b/tvix/cli/default.nix index 96a1b736686b..03c01ddc7783 100644 --- a/tvix/cli/default.nix +++ b/tvix/cli/default.nix @@ -1,25 +1,32 @@ { depot, pkgs, lib, ... }: +let + mkNixpkgsEvalCheck = attrset: expectedPath: { + label = ":nix: evaluate nixpkgs.${attrset} in tvix"; + needsOutput = true; + + command = pkgs.writeShellScript "tvix-eval-${builtins.replaceStrings [".drv"] ["-drv"] attrset}" '' + TVIX_OUTPUT=$(result/bin/tvix -E '(import ${pkgs.path} {}).${attrset}') + EXPECTED='${/* the verbatim expected Tvix output: */ "=> \"${expectedPath}\" :: string"}' + + echo "Tvix output: ''${TVIX_OUTPUT}" + if [ "$TVIX_OUTPUT" != "$EXPECTED" ]; then + echo "Correct would have been ''${EXPECTED}" + exit 1 + fi + + echo "Output was correct." + ''; + }; +in + (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" '' - 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." - ''; + ci.extraSteps = { + eval-nixpkgs-stdenv-drvpath = (mkNixpkgsEvalCheck "stdenv.drvPath" pkgs.stdenv.drvPath); + eval-nixpkgs-stdenv-outpath = (mkNixpkgsEvalCheck "stdenv.outPath" pkgs.stdenv.outPath); }; }; }) |