blob: 4480daecd9f52a42bb43085946e19cc13c0596ce (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# This tests verifies that the Nix implementation evaluating this has at least
# all the builtins given in `minimalBuiltins`. We don't test a precise list of
# builtins since we accept that there will always be difference between the
# builtins sets of Tvix, C++ Nix 2.3 and newer C++ Nix versions, as new builtins
# are added.
#
# Tvix also may choose never to implement some builtins if they are only useful
# for flakes or perform well enough via the shims nixpkgs usually provides.
let
# C++ Nix 2.3 builtins except valueSize which is removed in later versions
minimalBuiltins = [
"abort"
"add"
"addErrorContext"
"all"
"any"
"appendContext"
"attrNames"
"attrValues"
"baseNameOf"
"bitAnd"
"bitOr"
"bitXor"
"builtins"
"catAttrs"
"compareVersions"
"concatLists"
"concatMap"
"concatStringsSep"
"currentSystem"
"currentTime"
"deepSeq"
"derivation"
"derivationStrict"
"dirOf"
"div"
"elem"
"elemAt"
"false"
"fetchGit"
"fetchMercurial"
"fetchTarball"
"fetchurl"
"filter"
"filterSource"
"findFile"
"foldl'"
"fromJSON"
"fromTOML"
"functionArgs"
"genList"
"genericClosure"
"getAttr"
"getContext"
"getEnv"
"hasAttr"
"hasContext"
"hashFile"
"hashString"
"head"
"import"
"intersectAttrs"
"isAttrs"
"isBool"
"isFloat"
"isFunction"
"isInt"
"isList"
"isNull"
"isPath"
"isString"
"langVersion"
"length"
"lessThan"
"listToAttrs"
"map"
"mapAttrs"
"match"
"mul"
"nixPath"
"nixVersion"
"null"
"parseDrvName"
"partition"
"path"
"pathExists"
"placeholder"
"readDir"
"readFile"
"removeAttrs"
"replaceStrings"
"scopedImport"
"seq"
"sort"
"split"
"splitVersion"
"storeDir"
"storePath"
"stringLength"
"sub"
"substring"
"tail"
"throw"
"toFile"
"toJSON"
"toPath"
"toString"
"toXML"
"trace"
"true"
"tryEval"
"typeOf"
"unsafeDiscardOutputDependency"
"unsafeDiscardStringContext"
"unsafeGetAttrPos"
];
intersectLists = as: bs: builtins.filter (a: builtins.elem a bs) as;
in
intersectLists minimalBuiltins (builtins.attrNames builtins)
|