about summary refs log tree commit diff
path: root/tvix/cli
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-02-02T21·49+0300
committertazjin <tazjin@tvl.su>2023-02-03T10·47+0000
commit0dd07440b4d92745ee93026e407e48cd10ef5edf (patch)
tree1dda3e2d4c78cacba3669421ce0354d8b1b2b459 /tvix/cli
parent3419f63575fdf9c08477967183a0c34ff9433884 (diff)
test(tvix/cli): eval nixpkgs.stdenv in CI and assert that it matches r/5829
Change-Id: If80194b5fdbf69512217bd4780e416e678045323
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8023
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/cli')
-rw-r--r--tvix/cli/default.nix28
1 files changed, 26 insertions, 2 deletions
diff --git a/tvix/cli/default.nix b/tvix/cli/default.nix
index 7cb91979fd62..82e6c17c8268 100644
--- a/tvix/cli/default.nix
+++ b/tvix/cli/default.nix
@@ -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."
+      '';
+    };
+  };
+})