From 3ac995a5680610000f36c855435062626cde1bed Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 15 Apr 2020 08:07:11 -0400 Subject: [PATCH] maintainer lib test: extract maintainer module --- lib/tests/maintainer-module.nix | 31 +++++++++++++++++++++++++++++++ lib/tests/maintainers.nix | 32 +------------------------------- 2 files changed, 32 insertions(+), 31 deletions(-) create mode 100644 lib/tests/maintainer-module.nix diff --git a/lib/tests/maintainer-module.nix b/lib/tests/maintainer-module.nix new file mode 100644 index 000000000000..8cf8411b476a --- /dev/null +++ b/lib/tests/maintainer-module.nix @@ -0,0 +1,31 @@ +{ lib, ... }: +let + inherit (lib) types; +in { + options = { + name = lib.mkOption { + type = types.str; + }; + email = lib.mkOption { + type = types.str; + }; + matrix = lib.mkOption { + type = types.nullOr types.str; + default = null; + }; + github = lib.mkOption { + type = types.nullOr types.str; + default = null; + }; + githubId = lib.mkOption { + type = types.nullOr types.ints.unsigned; + default = null; + }; + keys = lib.mkOption { + type = types.listOf (types.submodule { + options.fingerprint = lib.mkOption { type = types.str; }; + }); + default = []; + }; + }; +} diff --git a/lib/tests/maintainers.nix b/lib/tests/maintainers.nix index aa10cc0fb4af..d9d21ea74fbe 100644 --- a/lib/tests/maintainers.nix +++ b/lib/tests/maintainers.nix @@ -7,43 +7,13 @@ let inherit (lib) types; - - maintainerModule = { config, ... }: { - options = { - name = lib.mkOption { - type = types.str; - }; - email = lib.mkOption { - type = types.str; - }; - matrix = lib.mkOption { - type = types.nullOr types.str; - default = null; - }; - github = lib.mkOption { - type = types.nullOr types.str; - default = null; - }; - githubId = lib.mkOption { - type = types.nullOr types.ints.unsigned; - default = null; - }; - keys = lib.mkOption { - type = types.listOf (types.submodule { - options.fingerprint = lib.mkOption { type = types.str; }; - }); - default = []; - }; - }; - }; - checkMaintainer = handle: uncheckedAttrs: let prefix = [ "lib" "maintainers" handle ]; checkedAttrs = (lib.modules.evalModules { inherit prefix; modules = [ - maintainerModule + ./maintainer-module.nix { _file = toString ../../maintainers/maintainer-list.nix; config = uncheckedAttrs;