From cd586e219d37a10ab62f3526374dd51db16697a8 Mon Sep 17 00:00:00 2001 From: Felix Stupp Date: Sat, 22 Aug 2026 22:10:36 +0000 Subject: [PATCH] pkgs.formats: fix importing toPretty from lib.generators Under a given edge case, the code in nixConf of formats.nix will fail incorrectly while rendering a pretty abort msg because lib.toPretty does not exist. This fixes this, inheriting toPretty from lib.generators. Then under the given edge case, nixConf fails correctly with a pretty abort msg. The edge case is playing with in nixos/modules/config/nix.nix with the type of nix.settings s.t. a value not supported by nixConf gets accepted as a value inside `nix.settings`. A quick way to reproduce this edge case is by appending ```nix apply = v: { }; ``` to the option declaration of `nix.settings.substituters`, then evaluting any nixos config, e.g.: `nix build .#nixosTests.systemd-journal-upload` --- pkgs/pkgs-lib/formats.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/pkgs-lib/formats.nix b/pkgs/pkgs-lib/formats.nix index e6fdfff69f21..fc48c78a3d73 100644 --- a/pkgs/pkgs-lib/formats.nix +++ b/pkgs/pkgs-lib/formats.nix @@ -24,7 +24,6 @@ let singleton strings toJSON - toPretty types versionAtLeast warn @@ -39,6 +38,7 @@ let toLua mkLuaInline toPlist + toPretty ; inherit (lib.types)