From cc86a8faa0cd1bfb611efb115f64d9aaf61a28dc Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 7 May 2026 17:03:00 -0400 Subject: [PATCH] lib.types: inherit builtins into scope --- lib/types.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/types.nix b/lib/types.nix index 067f8c3465e2..237d229058ff 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -17,6 +17,7 @@ let isPath isStorePath isString + substring throwIf toDerivation toList @@ -74,6 +75,7 @@ let unions empty ; + inherit (lib.path) hasStorePathPrefix; inAttrPosSuffix = v: name: @@ -713,15 +715,15 @@ rec { check = x: let - isInStore = lib.path.hasStorePathPrefix ( - if builtins.isPath x then + isInStore = hasStorePathPrefix ( + if isPath x then x # Discarding string context is necessary to convert the value to # a path and safe as the result is never used in any derivation. else /. + builtins.unsafeDiscardStringContext x ); - isAbsolute = builtins.substring 0 1 (toString x) == "/"; + isAbsolute = substring 0 1 (toString x) == "/"; isExpectedType = ( if inStore == null || inStore then isStringLike x else isString x # Do not allow a true path, which could be copied to the store later on. );