hasContext
builtins.hasContext
Primop
Docs pulled from | This Revision | about 13 hours ago
Takes 1 arguments
s
Return true
if string s has a non-empty context.
The context can be obtained with
getContext
.
Example
Many operations require a string context to be empty because they are intended only to work with "regular" strings, and also to help users avoid unintentionally loosing track of string context elements.
builtins.hasContext
can help create better domain-specific errors in those case.
name: meta: if builtins.hasContext name then throw "package name cannot contain string context" else { ${name} = meta; }
This function is not defined in a .nix file. It is likely a builtins function or an alias of a builtins function. builtins functions are predefined functions provided by Nix.
Noogle detected
Implementation
This function is implemented in c++ and is part of the native nix runtime.