Unary operator applications are thunked which can easily be observed by
nix-instantiate --eval -E '[ (!true) (-1) ]'
Unfortunately, there are few simple expressions where this makes a
difference in the end result. Thus it only cropped up when using nixpkgs
for cross compilation: Here we would compile the expression
!(stdenv.cc.isGNU or false)
to assemble python3Minimal's passthru attribute set (at least this seems
to be the most likely explanation from the backtraces I've studied).
This means that an unthunked
<stdenv.cc.isGNU or false>
OpForce
OpInvert
would be performed in order to assemble this attribute set, causing
stdenv.cc to be evaluated too early, causing an infinite recursion.
Resolves b/273.
It seems that having a test suite that doesn't use --strict and relies
on thunks rendered as <CODE> would be beneficial for catching such
issues. I've not been able to find a test case with --strict that
demonstrates the problem fixed in this CL.
Change-Id: I640a5827b963f5b9d0f86fa2142e75e3a6bbee78
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8654
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
36 lines
1.3 KiB
Nix
36 lines
1.3 KiB
Nix
{ 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-drvpath = (mkNixpkgsEvalCheck "stdenv.drvPath" pkgs.stdenv.drvPath);
|
|
eval-nixpkgs-stdenv-outpath = (mkNixpkgsEvalCheck "stdenv.outPath" pkgs.stdenv.outPath);
|
|
eval-nixpkgs-hello-outpath = (mkNixpkgsEvalCheck "hello.outPath" pkgs.hello.outPath);
|
|
|
|
# This is the furthest we get starting with stdenv we hit something similar to b/261
|
|
eval-nixpkgs-cross-gcc-outpath = (mkNixpkgsEvalCheck "pkgsCross.aarch64-multiplatform.buildPackages.gcc.outPath" pkgs.pkgsCross.aarch64-multiplatform.buildPackages.gcc.outPath);
|
|
};
|
|
};
|
|
})
|