2022-08-24 13:24:57 +02:00
|
|
|
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
|
|
|
|
|
2022-10-30 21:42:29 +01:00
|
|
|
The `impl` column indicates implementation status in tvix:
|
|
|
|
- implemented: "" (empty cell)
|
|
|
|
- not yet implemented, but not blocked: `todo`
|
|
|
|
- not yet implemented, but blocked by other prerequisites:
|
|
|
|
- `store`: awaiting eval<->store api(s)
|
|
|
|
- `context`: awaiting support for string contexts
|
|
|
|
|
|
|
|
| name | global | arity | pure | impl |
|
|
|
|
|-------------------------------|--------|-------|-------|---------|
|
|
|
|
| abort | true | 1 | | |
|
|
|
|
| add | false | 2 | true | |
|
|
|
|
| addErrorContext | false | ? | | context |
|
|
|
|
| all | false | 2 | true | |
|
|
|
|
| any | false | 2 | true | |
|
|
|
|
| appendContext | false | ? | | context |
|
|
|
|
| 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 | | false | |
|
|
|
|
| deepSeq | false | | | |
|
|
|
|
| derivation | true | | | store |
|
|
|
|
| derivationStrict | true | | | store |
|
|
|
|
| dirOf | true | | | |
|
|
|
|
| div | false | | | |
|
|
|
|
| elem | false | | | |
|
|
|
|
| elemAt | false | | | |
|
|
|
|
| false | true | | | |
|
|
|
|
| fetchGit | true | | | store |
|
|
|
|
| fetchMercurial | true | | | store |
|
|
|
|
| fetchTarball | true | | | store |
|
|
|
|
| fetchurl | false | | | store |
|
|
|
|
| filter | false | | | |
|
|
|
|
| filterSource | false | | | store |
|
|
|
|
| findFile | false | | false | todo |
|
|
|
|
| foldl' | false | | | |
|
|
|
|
| fromJSON | false | | | |
|
|
|
|
| fromTOML | true | | | |
|
|
|
|
| functionArgs | false | | | |
|
|
|
|
| genList | false | | | |
|
|
|
|
| genericClosure | false | | | todo |
|
|
|
|
| getAttr | false | | | |
|
2023-12-26 02:18:33 +01:00
|
|
|
| getContext | false | | | |
|
2022-10-30 21:42:29 +01:00
|
|
|
| getEnv | false | | false | |
|
|
|
|
| hasAttr | false | | | |
|
2023-12-25 22:06:52 +01:00
|
|
|
| hasContext | false | | | |
|
2024-02-22 16:33:29 +01:00
|
|
|
| hashFile | false | | false | |
|
2024-02-21 17:49:07 +01:00
|
|
|
| hashString | false | | | |
|
2022-10-30 21:42:29 +01:00
|
|
|
| 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 | | | todo |
|
|
|
|
| nixVersion | false | | | todo |
|
|
|
|
| null | true | | | |
|
|
|
|
| parseDrvName | false | | | |
|
|
|
|
| partition | false | | | |
|
|
|
|
| path | false | | sometimes | store |
|
|
|
|
| pathExists | false | | false | |
|
|
|
|
| placeholder | true | | | context |
|
|
|
|
| readDir | false | | false | |
|
|
|
|
| readFile | false | | false | |
|
|
|
|
| removeAttrs | true | | | |
|
|
|
|
| replaceStrings | false | | | |
|
|
|
|
| scopedImport | true | | | |
|
|
|
|
| seq | false | | | |
|
|
|
|
| sort | false | | | |
|
2022-10-31 11:47:50 +01:00
|
|
|
| split | false | | | |
|
2022-10-30 21:42:29 +01:00
|
|
|
| splitVersion | false | | | |
|
|
|
|
| storeDir | false | | | store |
|
|
|
|
| storePath | false | | | store |
|
|
|
|
| stringLength | false | | | |
|
|
|
|
| sub | false | | | |
|
|
|
|
| substring | false | | | |
|
|
|
|
| tail | false | | | |
|
|
|
|
| throw | true | | | |
|
|
|
|
| toFile | false | | | store |
|
2024-02-03 11:03:39 +01:00
|
|
|
| toJSON | false | | | |
|
2022-10-30 21:42:29 +01:00
|
|
|
| toPath | false | | | |
|
|
|
|
| toString | true | | | |
|
2024-01-20 21:02:34 +01:00
|
|
|
| toXML | true | | | |
|
2022-10-30 21:42:29 +01:00
|
|
|
| trace | false | | | |
|
|
|
|
| true | true | | | |
|
|
|
|
| tryEval | false | | | |
|
|
|
|
| typeOf | false | | | |
|
|
|
|
| unsafeDiscardOutputDependency | false | | | context |
|
2023-12-25 22:07:14 +01:00
|
|
|
| unsafeDiscardStringContext | false | | | |
|
2022-10-30 21:42:29 +01:00
|
|
|
| unsafeGetAttrPos | false | | | todo |
|
|
|
|
| valueSize | false | | | todo |
|
2022-08-24 13:24:57 +02:00
|
|
|
|
2022-09-04 22:28:42 +02:00
|
|
|
## Added after C++ Nix 2.3 (without Flakes enabled)
|
|
|
|
|
2022-10-30 21:42:29 +01:00
|
|
|
| name | global | arity | pure | impl |
|
|
|
|
|---------------|--------|-------|-------|-------|
|
|
|
|
| break | false | 1 | | todo |
|
|
|
|
| ceil | false | 1 | true | |
|
|
|
|
| fetchTree | true | 1 | | todo |
|
|
|
|
| floor | false | 1 | true | |
|
|
|
|
| groupBy | false | 2 | true | |
|
|
|
|
| traceVerbose | false | 2 | | todo |
|
|
|
|
| zipAttrsWith | false | 2 | true | todo |
|