mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-27 02:34:53 +00:00
With this patch I essentially get the expected list of maintainers for changes in
nixos-tests.
The downside of this approach is that the CI facility assumes that
there's at most a single definition of `meta.maintainers`, however it
can be more in a module-system context.
For simplicity, just use the first definition location for the time
being.
Verified with
let
lib = import ./lib;
maintainers = import ./ci/eval/compare/maintainers.nix { inherit lib; };
in
maintainers {
changedFiles = [
"nixos/tests/matrix/matrix-authentication-service.nix"
];
affectedAttrPaths = map (lib.splitString ".") [
"nixosTests.matrix-authentication-service"
];
}
96 lines
3.7 KiB
Nix
96 lines
3.7 KiB
Nix
{ 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 = {
|
|
meta = mkOption {
|
|
description = ''
|
|
The [`meta`](https://nixos.org/manual/nixpkgs/stable/#chap-meta) attributes that will be set on the returned derivations.
|
|
|
|
Not all [`meta`](https://nixos.org/manual/nixpkgs/stable/#chap-meta) attributes are supported, but more can be added as desired.
|
|
'';
|
|
apply = lib.filterAttrs (k: v: v != null);
|
|
type = types.submodule (
|
|
{ options, config, ... }:
|
|
{
|
|
options = {
|
|
maintainers = mkOption {
|
|
type = types.listOf types.raw;
|
|
default = [ ];
|
|
description = ''
|
|
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
|
|
description = ''
|
|
The [{option}`test`](#test-opt-test)'s [`meta.timeout`](https://nixos.org/manual/nixpkgs/stable/#var-meta-timeout) in seconds.
|
|
'';
|
|
};
|
|
broken = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Sets the [`meta.broken`](https://nixos.org/manual/nixpkgs/stable/#var-meta-broken) attribute on the [{option}`test`](#test-opt-test) derivation.
|
|
'';
|
|
};
|
|
platforms = mkOption {
|
|
type = types.listOf types.raw;
|
|
default = lib.platforms.linux ++ lib.platforms.darwin;
|
|
description = ''
|
|
Sets the [`meta.platforms`](https://nixos.org/manual/nixpkgs/stable/#var-meta-platforms) attribute on the [{option}`test`](#test-opt-test) derivation.
|
|
'';
|
|
};
|
|
hydraPlatforms = mkOption {
|
|
type = types.listOf types.raw;
|
|
# Ideally this would default to `platforms` again:
|
|
# default = config.platforms;
|
|
default = lib.platforms.linux;
|
|
defaultText = literalMD "`lib.platforms.linux` only, as the `hydra.nixos.org` build farm does not currently support virtualisation on Darwin.";
|
|
description = ''
|
|
Sets the [`meta.hydraPlatforms`](https://nixos.org/manual/nixpkgs/stable/#var-meta-hydraPlatforms) attribute on the [{option}`test`](#test-opt-test) derivation.
|
|
'';
|
|
};
|
|
};
|
|
}
|
|
);
|
|
default = { };
|
|
};
|
|
};
|
|
}
|