From 9a8512f4600d34289b197402c37f079add5835e5 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Fri, 30 Aug 2024 00:46:31 +0200 Subject: [PATCH] nixos/meta: remove `with lib;` --- nixos/modules/misc/meta.nix | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/nixos/modules/misc/meta.nix b/nixos/modules/misc/meta.nix index e5ab3a951537..1569662b403c 100644 --- a/nixos/modules/misc/meta.nix +++ b/nixos/modules/misc/meta.nix @@ -1,28 +1,25 @@ { lib, ... }: - -with lib; - let - maintainer = mkOptionType { + maintainer = lib.mkOptionType { name = "maintainer"; - check = email: elem email (attrValues lib.maintainers); - merge = loc: defs: listToAttrs (singleton (nameValuePair (last defs).file (last defs).value)); + check = email: lib.elem email (lib.attrValues lib.maintainers); + merge = loc: defs: lib.listToAttrs (lib.singleton (lib.nameValuePair (lib.last defs).file (lib.last defs).value)); }; - listOfMaintainers = types.listOf maintainer // { + listOfMaintainers = lib.types.listOf maintainer // { # Returns list of # { "module-file" = [ # "maintainer1 " # "maintainer2 " ]; # } merge = loc: defs: - zipAttrs - (flatten (imap1 (n: def: imap1 (m: def': + lib.zipAttrs + (lib.flatten (lib.imap1 (n: def: lib.imap1 (m: def': maintainer.merge (loc ++ ["[${toString n}-${toString m}]"]) [{ inherit (def) file; value = def'; }]) def.value) defs)); }; - docFile = types.path // { + docFile = lib.types.path // { # Returns tuples of # { file = "module location"; value = ; } merge = loc: defs: defs; @@ -33,18 +30,18 @@ in options = { meta = { - maintainers = mkOption { + maintainers = lib.mkOption { type = listOfMaintainers; internal = true; default = []; - example = literalExpression ''[ lib.maintainers.all ]''; + example = lib.literalExpression ''[ lib.maintainers.all ]''; description = '' List of maintainers of each module. This option should be defined at most once per module. ''; }; - doc = mkOption { + doc = lib.mkOption { type = docFile; internal = true; example = "./meta.chapter.md"; @@ -54,8 +51,8 @@ in ''; }; - buildDocsInSandbox = mkOption { - type = types.bool // { + buildDocsInSandbox = lib.mkOption { + type = lib.types.bool // { merge = loc: defs: defs; }; internal = true; @@ -72,5 +69,5 @@ in }; }; - meta.maintainers = singleton lib.maintainers.pierron; + meta.maintainers = lib.singleton lib.maintainers.pierron; }