git.iko.soy/typeable/nixpkgs
on master help sign in
meta.tests: rename into passthru.tests

Nix currently rejects derivations in `meta` values. This works around that limitation by using `passthru` instead. Closes https://github.com/NixOS/nixpkgs/issues/50230

commit2986ce16a8012e90f0066b7bc9ccea1543644a4b authorLéo Gaspard <leo@gaspard.io> dateSun 11 Nov 2018, 22:55 (8 years ago) parentcae5598
5 files changed+20−14
doc/meta.xml+12−1 nixos/tests/all-tests.nix+1−1 pkgs/servers/mail/dovecot/default.nix+3−6 pkgs/servers/mail/opensmtpd/default.nix+3−6 pkgs/stdenv/generic/check-meta.nix+1
doc/meta.xml+12−1
@@ -255,6 +255,17 @@ meta.platforms = stdenv.lib.platforms.linux;
255255 <varname>tests</varname>
256256 </term>
257257 <listitem>
258+ <warning>
259+ <para>
260+ This attribute is special in that it is not actually under the
261+ <literal>meta</literal> attribute set but rather under the
262+ <literal>passthru</literal> attribute set. This is due to a current
263+ limitation of Nix, and will change as soon as Nixpkgs will be able to
264+ depend on a new enough version of Nix. See
265+ <link xlink:href="https://github.com/NixOS/nix/issues/2532">the relevant
266+ issue</link> for more details.
267+ </para>
268+ </warning>
258269 <para>
259270 An attribute set with as values tests. A test is a derivation, which
260271 builds successfully when the test passes, and fails to build otherwise. A
@@ -269,7 +280,7 @@ meta.platforms = stdenv.lib.platforms.linux;
269280{ /* ... */, nixosTests }:
270281{
271282 # ...
272− meta.tests = {
283+ passthru.tests = {
273284 basic-functionality-and-dovecot-integration = nixosTests.opensmtpd;
274285 };
275286}
nixos/tests/all-tests.nix+1−1
@@ -2,7 +2,7 @@
22# The return value of this function will be an attrset with arbitrary depth and
33# the `anything` returned by callTest at its test leafs.
44# The tests not supported by `system` will be replaced with `{}`, so that
5−# `meta.tests` can contain links to those without breaking on architectures
5+# `passthru.tests` can contain links to those without breaking on architectures
66# where said tests are unsupported.
77# Example callTest that just extracts the derivation from the test:
88# callTest = t: t.test;
pkgs/servers/mail/dovecot/default.nix+3−6
@@ -68,11 +68,8 @@ stdenv.mkDerivation rec {
6868 description = "Open source IMAP and POP3 email server written with security primarily in mind";
6969 maintainers = with stdenv.lib.maintainers; [ peti rickynils fpletz ];
7070 platforms = stdenv.lib.platforms.unix;
71− # https://github.com/NixOS/nixpkgs/issues/50230 must be resolved before
72− # this can be enabled.
73− #
74− # tests = {
75− # opensmtpd-interaction = nixosTests.opensmtpd;
76− # };
71+ };
72+ passthru.tests = {
73+ opensmtpd-interaction = nixosTests.opensmtpd;
7774 };
7875}
pkgs/servers/mail/opensmtpd/default.nix+3−6
@@ -61,11 +61,8 @@ stdenv.mkDerivation rec {
6161 license = licenses.isc;
6262 platforms = platforms.linux;
6363 maintainers = with maintainers; [ rickynils obadz ekleog ];
64− # https://github.com/NixOS/nixpkgs/issues/50230 must be resolved before
65− # this can be enabled.
66− #
67− # tests = {
68− # basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd;
69− # };
64+ };
65+ passthru.tests = {
66+ basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd;
7067 };
7168}
pkgs/stdenv/generic/check-meta.nix+1
@@ -166,6 +166,7 @@ let
166166 hydraPlatforms = listOf str;
167167 broken = bool;
168168 # TODO: refactor once something like Profpatsch's types-simple will land
169+ # This is currently dead code due to https://github.com/NixOS/nix/issues/2532
169170 tests = attrsOf (mkOptionType {
170171 name = "test";
171172 check = x: x == {} || ( # Accept {} for tests that are unsupported