From 2986ce16a8012e90f0066b7bc9ccea1543644a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Gaspard?= Date: Sun, 11 Nov 2018 22:55:23 +0900 Subject: [PATCH] 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 --- doc/meta.xml | 13 ++++++++++++- nixos/tests/all-tests.nix | 2 +- pkgs/servers/mail/dovecot/default.nix | 9 +++------ pkgs/servers/mail/opensmtpd/default.nix | 9 +++------ pkgs/stdenv/generic/check-meta.nix | 1 + 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/doc/meta.xml b/doc/meta.xml index a7e467a78cbd..3abfe016d708 100644 --- a/doc/meta.xml +++ b/doc/meta.xml @@ -255,6 +255,17 @@ meta.platforms = stdenv.lib.platforms.linux; tests + + + This attribute is special in that it is not actually under the + meta attribute set but rather under the + passthru attribute set. This is due to a current + limitation of Nix, and will change as soon as Nixpkgs will be able to + depend on a new enough version of Nix. See + the relevant + issue for more details. + + An attribute set with as values tests. A test is a derivation, which builds successfully when the test passes, and fails to build otherwise. A @@ -269,7 +280,7 @@ meta.platforms = stdenv.lib.platforms.linux; { /* ... */, nixosTests }: { # ... - meta.tests = { + passthru.tests = { basic-functionality-and-dovecot-integration = nixosTests.opensmtpd; }; } diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 0d6dc48c9d64..718a95dadd26 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -2,7 +2,7 @@ # The return value of this function will be an attrset with arbitrary depth and # the `anything` returned by callTest at its test leafs. # The tests not supported by `system` will be replaced with `{}`, so that -# `meta.tests` can contain links to those without breaking on architectures +# `passthru.tests` can contain links to those without breaking on architectures # where said tests are unsupported. # Example callTest that just extracts the derivation from the test: # callTest = t: t.test; diff --git a/pkgs/servers/mail/dovecot/default.nix b/pkgs/servers/mail/dovecot/default.nix index af1184a973b8..f80a01e20f88 100644 --- a/pkgs/servers/mail/dovecot/default.nix +++ b/pkgs/servers/mail/dovecot/default.nix @@ -68,11 +68,8 @@ stdenv.mkDerivation rec { description = "Open source IMAP and POP3 email server written with security primarily in mind"; maintainers = with stdenv.lib.maintainers; [ peti rickynils fpletz ]; platforms = stdenv.lib.platforms.unix; - # https://github.com/NixOS/nixpkgs/issues/50230 must be resolved before - # this can be enabled. - # - # tests = { - # opensmtpd-interaction = nixosTests.opensmtpd; - # }; + }; + passthru.tests = { + opensmtpd-interaction = nixosTests.opensmtpd; }; } diff --git a/pkgs/servers/mail/opensmtpd/default.nix b/pkgs/servers/mail/opensmtpd/default.nix index 5efaca40f6ee..695450f18222 100644 --- a/pkgs/servers/mail/opensmtpd/default.nix +++ b/pkgs/servers/mail/opensmtpd/default.nix @@ -61,11 +61,8 @@ stdenv.mkDerivation rec { license = licenses.isc; platforms = platforms.linux; maintainers = with maintainers; [ rickynils obadz ekleog ]; - # https://github.com/NixOS/nixpkgs/issues/50230 must be resolved before - # this can be enabled. - # - # tests = { - # basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd; - # }; + }; + passthru.tests = { + basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd; }; } diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 301080f0f906..d09dff10b278 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -166,6 +166,7 @@ let hydraPlatforms = listOf str; broken = bool; # TODO: refactor once something like Profpatsch's types-simple will land + # This is currently dead code due to https://github.com/NixOS/nix/issues/2532 tests = attrsOf (mkOptionType { name = "test"; check = x: x == {} || ( # Accept {} for tests that are unsupported