1{ lib, ... }:
2let
3 inherit (lib) types mkOption literalMD;
4in
5{
6 options = {
7 meta = mkOption {
8 description = ''
9 The [`meta`](https://nixos.org/manual/nixpkgs/stable/#chap-meta) attributes that will be set on the returned derivations.
10
11 Not all [`meta`](https://nixos.org/manual/nixpkgs/stable/#chap-meta) attributes are supported, but more can be added as desired.
12 '';
13 apply = lib.filterAttrs (k: v: v != null);
14 type = types.submodule (
15 { config, ... }:
16 {
17 options = {
18 maintainers = mkOption {
19 type = types.listOf types.raw;
20 default = [ ];
21 description = ''
22 The [list of maintainers](https://nixos.org/manual/nixpkgs/stable/#var-meta-maintainers) for this test.
23 '';
24 };
25 timeout = mkOption {
26 type = types.nullOr types.int;
27 default = 3600; # 1 hour
28 description = ''
29 The [{option}`test`](#test-opt-test)'s [`meta.timeout`](https://nixos.org/manual/nixpkgs/stable/#var-meta-timeout) in seconds.
30 '';
31 };
32 broken = mkOption {
33 type = types.bool;
34 default = false;
35 description = ''
36 Sets the [`meta.broken`](https://nixos.org/manual/nixpkgs/stable/#var-meta-broken) attribute on the [{option}`test`](#test-opt-test) derivation.
37 '';
38 };
39 platforms = mkOption {
40 type = types.listOf types.raw;
41 default = lib.platforms.linux ++ lib.platforms.darwin;
42 description = ''
43 Sets the [`meta.platforms`](https://nixos.org/manual/nixpkgs/stable/#var-meta-platforms) attribute on the [{option}`test`](#test-opt-test) derivation.
44 '';
45 };
46 hydraPlatforms = mkOption {
47 type = types.listOf types.raw;
48 # Ideally this would default to `platforms` again:
49 # default = config.platforms;
50 default = lib.platforms.linux;
51 defaultText = literalMD "`lib.platforms.linux` only, as the `hydra.nixos.org` build farm does not currently support virtualisation on Darwin.";
52 description = ''
53 Sets the [`meta.hydraPlatforms`](https://nixos.org/manual/nixpkgs/stable/#var-meta-hydraPlatforms) attribute on the [{option}`test`](#test-opt-test) derivation.
54 '';
55 };
56 };
57 }
58 );
59 default = { };
60 };
61 };
62}