From a822df313f4d687d897767f5612f860398dfd41e Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Tue, 10 Jun 2025 16:29:36 -0700 Subject: [PATCH] formats: extract things needed from pkgs in the let binding This is an attempt to solve the NixOS manual failures seen in https://github.com/NixOS/nixpkgs/pull/415662 --- pkgs/pkgs-lib/formats.nix | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/pkgs/pkgs-lib/formats.nix b/pkgs/pkgs-lib/formats.nix index 096000cba925..9113d8ec3307 100644 --- a/pkgs/pkgs-lib/formats.nix +++ b/pkgs/pkgs-lib/formats.nix @@ -52,26 +52,26 @@ let # Attributes added accidentally in https://github.com/NixOS/nixpkgs/pull/335232 (2024-08-18) # Deprecated in https://github.com/NixOS/nixpkgs/pull/415666 (2025-06) - aliases = - lib.mapAttrs (name: lib.warn "`formats.${name}` is deprecated; use `lib.types.${name}` instead.") - { - inherit - attrsOf - bool - coercedTo - either - float - int - listOf - luaInline - mkOptionType - nonEmptyListOf - nullOr - oneOf - path - str - ; - }; + allowAliases = pkgs.config.allowAliases or false; + aliasWarning = name: warn "`formats.${name}` is deprecated; use `lib.types.${name}` instead."; + aliases = mapAttrs aliasWarning { + inherit + attrsOf + bool + coercedTo + either + float + int + listOf + luaInline + mkOptionType + nonEmptyListOf + nullOr + oneOf + path + str + ; + }; in optionalAttrs allowAliases aliases // rec {