diff --git a/nixos/doc/manual/redirects.json b/nixos/doc/manual/redirects.json index 12cfdd1d9063..27be44d30b25 100644 --- a/nixos/doc/manual/redirects.json +++ b/nixos/doc/manual/redirects.json @@ -2306,6 +2306,9 @@ "test-opt-meta.hydraPlatforms": [ "index.html#test-opt-meta.hydraPlatforms" ], + "test-opt-meta.teams": [ + "index.html#test-opt-meta.teams" + ], "test-opt-meta.timeout": [ "index.html#test-opt-meta.timeout" ], diff --git a/nixos/lib/testing/meta.nix b/nixos/lib/testing/meta.nix index 1e8f37cf9b51..2194c04f4eda 100644 --- a/nixos/lib/testing/meta.nix +++ b/nixos/lib/testing/meta.nix @@ -1,6 +1,20 @@ -{ lib, ... }: +{ lib, options, ... }: let inherit (lib) types mkOption literalMD; + + # Approximate position of meta.teams / meta.maintainers in nixos tests. + # Right now this assumes only one such position and ignores other definitions. + # FIXME allow having multiple `maintainersPosition` et al.. + getPosition = + definitionsWithLocations: + if definitionsWithLocations == [ ] then + null + else + { + file = (lib.head definitionsWithLocations).file; + column = 0; + line = 1; + }; in { options = { @@ -12,7 +26,7 @@ in ''; apply = lib.filterAttrs (k: v: v != null); type = types.submodule ( - { config, ... }: + { options, config, ... }: { options = { maintainers = mkOption { @@ -22,6 +36,25 @@ in The [list of maintainers](https://nixos.org/manual/nixpkgs/stable/#var-meta-maintainers) for this test. ''; }; + maintainersPosition = mkOption { + internal = true; + readOnly = true; + type = types.nullOr types.attrs; + default = getPosition options.maintainers.definitionsWithLocations; + }; + teams = mkOption { + type = types.listOf types.raw; + default = [ ]; + description = '' + The [list of maintainer-teams](https://nixos.org/manual/nixpkgs/stable/#var-meta-teams) for this test. + ''; + }; + teamsPosition = mkOption { + internal = true; + readOnly = true; + type = types.nullOr types.attrs; + default = getPosition options.teams.definitionsWithLocations; + }; timeout = mkOption { type = types.nullOr types.int; default = 3600; # 1 hour