snix/tvix/eval/docs/builtins.md
sterni e25972877a docs(tvix/eval): add a list of builtins added in Nix >= 2.4
`builtins.getFlake` doesn't interest us, of course, but some others may
be worth (or easy) to implement. They are pretty low priority, though,
since nixpkgs has compatiblity wrappers for the ones it uses.

The new debugging-related builtins (break and traceVerbose) are
interesting to note, but may not make sense to implement at all.

Change-Id: Icae547aa3bd9d6ee6b87897ba8210eb9b9b044c7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6332
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
2022-09-04 21:02:51 +00:00

131 lines
6.9 KiB
Markdown

Nix builtins
============
Nix has a lot of built-in functions, some of which are accessible in
the global scope, and some of which are only accessible through the
global `builtins` attribute set.
This document is an attempt to track all of these builtins, but
without documenting their functionality.
See also https://nixos.org/manual/nix/stable/expressions/builtins.html
| name | global | arity | pure |
|-------------------------------|--------|-------|------|
| abort | true | 1 | |
| add | false | 2 | true |
| addErrorContext | false | ? | |
| all | false | 2 | true |
| any | false | 2 | true |
| appendContext | false | ? | |
| attrNames | false | 1 | true |
| attrValues | false | | true |
| baseNameOf | true | | |
| bitAnd | false | | |
| bitOr | false | | |
| bitXor | false | | |
| builtins | true | | |
| catAttrs | false | | |
| compareVersions | false | | |
| concatLists | false | | |
| concatMap | false | | |
| concatStringsSep | false | | |
| currentSystem | false | | |
| currentTime | false | | |
| deepSeq | false | | |
| derivation | true | | |
| derivationStrict | true | | |
| dirOf | true | | |
| div | false | | |
| elem | false | | |
| elemAt | false | | |
| false | true | | |
| fetchGit | true | | |
| fetchMercurial | true | | |
| fetchTarball | true | | |
| fetchurl | false | | |
| filter | false | | |
| filterSource | false | | |
| findFile | false | | |
| foldl' | false | | |
| fromJSON | false | | |
| fromTOML | true | | |
| functionArgs | false | | |
| genList | false | | |
| genericClosure | false | | |
| getAttr | false | | |
| getContext | false | | |
| getEnv | false | | |
| hasAttr | false | | |
| hasContext | false | | |
| hashFile | false | | |
| hashString | false | | |
| head | false | | |
| import | true | | |
| intersectAttrs | false | | |
| isAttrs | false | | |
| isBool | false | | |
| isFloat | false | | |
| isFunction | false | | |
| isInt | false | | |
| isList | false | | |
| isNull | true | | |
| isPath | false | | |
| isString | false | | |
| langVersion | false | | |
| length | false | | |
| lessThan | false | | |
| listToAttrs | false | | |
| map | true | | |
| mapAttrs | false | | |
| match | false | | |
| mul | false | | |
| nixPath | false | | |
| nixVersion | false | | |
| null | true | | |
| parseDrvName | false | | |
| partition | false | | |
| path | false | | |
| pathExists | false | | |
| placeholder | true | | |
| readDir | false | | |
| readFile | false | | |
| removeAttrs | true | | |
| replaceStrings | false | | |
| scopedImport | true | | |
| seq | false | | |
| sort | false | | |
| split | false | | |
| splitVersion | false | | |
| storeDir | false | | |
| storePath | false | | |
| stringLength | false | | |
| sub | false | | |
| substring | false | | |
| tail | false | | |
| throw | true | | |
| toFile | false | | |
| toJSON | false | | |
| toPath | false | | |
| toString | true | | |
| toXML | false | | |
| trace | false | | |
| true | true | | |
| tryEval | false | | |
| typeOf | false | | |
| unsafeDiscardOutputDependency | false | | |
| unsafeDiscardStringContext | false | | |
| unsafeGetAttrPos | false | | |
| valueSize | false | | |
## Added after C++ Nix 2.3 (without Flakes enabled)
| name | global | arity | pure |
|---------------|--------|-------|-------|
| break | false | 1 | |
| ceil | false | 1 | true |
| fetchTree | true | 1 | |
| floor | false | 1 | true |
| groupBy | false | 2 | true |
| traceVerbose | false | 2 | |
| zipAttrsWith | false | 2 | true |