mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-20 23:51:03 +00:00
lib.types: inherit builtins into scope
This commit is contained in:
@@ -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.
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user