nixos/testing: allow meta.teams in tests, fix maintainer pings for tests (#540388)

This commit is contained in:
Maximilian Bosch
2026-07-21 21:42:07 +00:00
committed by GitHub
2 changed files with 38 additions and 2 deletions

View File

@@ -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"
],

View File

@@ -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