lib.types: inherit builtins into scope

This commit is contained in:
Eman Resu
2026-05-07 17:03:00 -04:00
parent 6c84f96a96
commit cc86a8faa0

View File

@@ -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.
);