passthru.tests is wrong after overrides #119407
Labels
0.kind: bug
Something is broken
2.status: stale
https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
6.topic: stdenv
Standard environment
6.topic: testing
Tooling for automated testing of packages and modules
6.topic: user experience
Describe the bug
passthru
can not make use of the final pkg, leading to false test outcomes.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The above can be expected to fail, but the expression author did not have a means to use the overridden pkg, so we can't blame them.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Alternatives:
{ stdenv }: let this = stdenv.mkDerivation { passthru.tests = f this; }; in this
. This does not rely on the use of overlays, but doesn't support overriding.{ stdenv, mypkg }: stdenv.mkDerivation { passthru.tests = f mypkg; }
. This relies on overlays to inject the right package. This makes the package correctness depend on overlays, which can not be assumed in general.mkDerivation
, to make the final package available:{ stdenv }: stdenv.mkDerivation (pkg: { passthru.tests = f pkg; })
Option 3 supports overriding and does not rely on its caller for
passthru.tests
to be correct.Notify maintainers
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Maintainer information:
The text was updated successfully, but these errors were encountered: