passthru can not make use of the final pkg, leading to false test outcomes.
To Reproduce
Steps to reproduce the behavior:
nix-repl> :b (cacert.overrideAttrs (_: { fixupPhase = "rm -rf $out/* $unbundled/*"; })).passthru.tests.blacklist-utf8
warning: unknown setting 'experimental-features'
this derivation produced the following outputs:
out -> /nix/store/71z94ajbwvyq9jbf8avi38s8n3h4jq3w-verify-the-cacert-filter-output
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:
define packages as { 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.
define packages as { 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.
allow passing a function to 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.
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: