about summary refs log tree commit diff
path: root/tvix/cli/default.nix
blob: 82e6c17c82687a17d916d7fadba3989919880741 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ depot, pkgs, lib, ... }:

(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."
      '';
    };
  };
})