about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2022-10-22 r/5176 test(tvix/eval): add a test for observing an infinite attribute setVincent Ambo2-0/+5
Note that this test (ironically) fails if the observer is used (e.g. with --trace-runtime), but that's a separate issue. Change-Id: I952eaeac8b5a7acce9c66cd4744ec570280748e7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7055 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-10-22 r/5175 feat(tvix/eval): Implement builtins.deepSeqGriffin Smith10-62/+100
This is done via a new `deepForce` function on Value. Since values can be cyclical (for example, see the test-case), we need to do some extra work to avoid RefCell borrow errors if we ever hit a graph cycle: While deep-forcing values, we keep a set of thunks that we have already seen and avoid doing any work on the same thunk twice. The set is encapsulated in a separate type to stop potentially invalid pointers from leaking out. Finally, since deep_force is conceptually similar to `VM::force_for_output` (but more suited to usage in eval since it doesn't clone the values) this removes the latter, replacing it with the former. Co-Authored-By: Vincent Ambo <tazjin@tvl.su> Change-Id: Iefddefcf09fae3b6a4d161a5873febcff54b9157 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7000 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-22 r/5174 fix(tvix/eval): use top-level span for `force_with_output`Vincent Ambo3-6/+29
When forcing thunks in `force_with_output`, the call stack of the VM is actually empty (as the calls are synthetic and no longer part of the evaluation of the top-level expression). This means that Tvix crashed when constructing error spans for the `fallible` macro, as the assumption of there being an enclosing span was violated. To work around this, we instead pass the span for the whole top-level expression to force_for_output and set this as the span for the enclosing error chain. Existing output logic will already avoid printing the entire expression as an error span. This fixes b/213. Change-Id: I93978e0deaf5bcb0f47a6fa95b3f5bebef5bad4c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7052 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-10-21 r/5173 chore(buf): Use nixpkgs-provided bufFlorian Klink5-37/+14
The version of buf used is quite old. nixpkgs provides a more recent version, but it requires us to migrate config to the latest version. depot_scanner.proto doesn't honor some of the conventions, so we need allow_comment_ignores and drop a bunch of comments in there. Change-Id: Ic978fe92fb7c8471f58c137497528f18aad8f3ab Reviewed-on: https://cl.tvl.fyi/c/depot/+/7053 Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: tazjin <tazjin@tvl.su>
2022-10-21 r/5172 fix(tvix): distinguish search- and relative path resolution errorssterni4-11/+19
Failures to resolve a nix search path lookup in angle brackets can be caught using tryEval (if it reaches the runtime). Resolving relative paths (either to the current directory or the current user's home) can never be caught, even if they happen inside a thunk at runtime (which is currently the case for home-relative paths). Change-Id: I7f73221df66d82a381dd4063358906257826995a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7025 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-10-20 r/5171 refactor(nix/dependency-analyzer): use unsafeDiscardOutputDependencysterni1-18/+2
Turns out that pathContextDrvPath already exists as a builtin which is very convenient. Actually somewhat embarassing that I missed this for so long. Change-Id: Ieb5e113d70dec548b3053911ff9dbe9ed48402be Reviewed-on: https://cl.tvl.fyi/c/depot/+/7050 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5170 test(tvix/verify-lang-tests): also check notyetpassing testssterni1-12/+12
Adding these to the C++ Nix CI ensures that it is possible for the tests in that directory to pass at all. Mainly this would catch situations like fixed in a previous CL when moving the tests around would break them so that they wouldn't even pass in C++ Nix. For this to work, we need to track skips by basename to be directory-independent (assuming that every skipped test name is unique is hopefully okay). Change-Id: If6cb63ebdef0fc19b082b6a04e79ada2e47c658e Reviewed-on: https://cl.tvl.fyi/c/depot/+/7048 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5169 fix(nix/buildkite) don't fail if gated step has no branchesEvgeny Zemtsov1-1/+1
Change-Id: Id3365c18bc3904b42e8b129a513cff4480a2cb07 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7051 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5168 fix(tvix/eval): restore .exp.xml files and skip in test suitesterni3-0/+7
Change-Id: Iebda5e0d99925a0a8c1d6ae1d7a35397d127bf31 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7047 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-20 r/5167 fix(tvix/eval): fix path in notyetpassing testssterni4-4/+4
cl/7036 moved these paths around, but neglected to update the relative paths they contain. Without these updated, they will never start passing! Change-Id: Ib16468611af59729883e501be8486f43d850fd58 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7046 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5166 test(tvix/eval): eval-okay-eq.nix can actually be testedsterni3-1/+1
eval-okay-eq.nix is actually an ancient test case that used the ATerm syntax for the test result. It was disabled for a while, since the behavior got reverted for a bit, but works on any reasonably modern Nix implementation. This change matches my [C++ Nix PR]. [C++ Nix PR]: https://github.com/NixOS/nix/pull/7196 Change-Id: I602fd7c83a0bc104ab502c8b6a74e4591272be1a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7045 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5165 fix(tvix/eval): eval-okay-pathexists test can be executedsterni2-0/+0
Change-Id: Ibdcaa165024584370ce9578e67985a3526e44f77 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7044 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5164 test(tvix/eval): update C++ Nix test suite to current mastersterni23-32/+94
The language test suite actually doesn't require flakes and the new features are mostly sensible (added builtins) as well as some tests for regressions the C++ implementation experienced. The path interpolation test is not included in this update because there is no way to construct an location-independent .exp file for it (the C++ repo also doesn't have one). We may still want to implement that feature eventually (in case rnix adds support for it). The C++ Nix revision used is ac0fb38e8a5a25a84fa17704bd31b453211263eb. Change-Id: I75f1e780ddeeee6f6b1f28cf3c66c288dca2c20c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7043 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5163 test(tvix/eval): enable nix_tests by defaultsterni1-1/+1
Since cl/7036 we have a mechanism for dealing with the nix_tests we do not pass yet. Change-Id: I246c52963ae7f2500253f4035a77d7006dd35307 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7049 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-20 r/5162 test(tvix): nix-planned test verification using C++ Nix 2.3 and 2.11sterni3-120/+185
Reimplement the test discovery of the lang tests script in Nix which allows for a more flexible skipping logic that can e.g. react to the C++ Nix version used. This allows us to run the test suite against both C++ Nix 2.3 and the latest C++ Nix version 2.11. The latter is mainly useful, so we can implement newer Nix features and still verify them against the C++ implementation. Change-Id: I30c802844133b86b5e49f5e4f4fefacdb6215e0e Reviewed-on: https://cl.tvl.fyi/c/depot/+/7042 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-19 r/5161 feat(tvix/eval): expect not-yet-passing tests to failAdam Joseph74-14/+49
It is helpful to be able to use the test suite as a regression test: make a change to the compiler/vm, re-run the tests, and if there are any failures you know it's your fault. Right now we can't do that, because the expected-to-fail tests are mixed in with the expected-to-pass tests. So we can't use them as a regression test. Change-Id: Ied606882b9835a7effd7e75bfcf3e5f827e0a2c8 Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7036 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-19 r/5160 docs(REVIEWS.md): gerrit-for-github guide, warn about attention setsAdam Joseph1-0/+37
Change-Id: Ia20feacbb7394daaa1f1ed0d1e05c7441a187744 Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7035 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-19 r/5159 feat(tvix/eval): deduplicate overlap between Closure and ThunkAdam Joseph9-149/+203
This commit deduplicates the Thunk-like functionality from Closure and unifies it with Thunk. Specifically, we now have one and only one way of breaking reference cycles in the Value-graph: Thunk. No other variant contains a RefCell. This should make it easier to reason about the behavior of the VM. InnerClosure and UpvaluesCarrier are no longer necessary. This refactoring allowed an improvement in code generation: `Rc<RefCell<>>`s are now created only for closures which do not have self-references or deferred upvalues, instead of for all closures. OpClosure has been split into two separate opcodes: - OpClosure creates non-recursive closures with no deferred upvalues. The VM will not create an `Rc<RefCell<>>` when executing this instruction. - OpThunkClosure is used for closures with self-references or deferred upvalues. The VM will create a Thunk when executing this opcode, but the Thunk will start out already in the `ThunkRepr::Evaluated` state, rather than in the `ThunkRepr::Suspeneded` state. To avoid confusion, OpThunk has been renamed OpThunkSuspended. Thanks to @sterni for suggesting that all this could be done without adding an additional variant to ThunkRepr. This does however mean that there will be mutating accesses to `ThunkRepr::Evaluated`, which was not previously the case. The field `is_finalised:bool` has been added to `Closure` to ensure that these mutating accesses are performed only on finalised Closures. Both the check and the field are present only if `#[cfg(debug_assertions)]`. Change-Id: I04131501029772f30e28da8281d864427685097f Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7019 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-19 r/5158 feat(tvix/eval): NixList::concat(): avoid an unnecessary moveAdam Joseph1-4/+3
In `a++b`, the previous implementation would move `b` (i.e. memcpy its elements) twice. Let's do that only once. We sure do call NixList.clone() a whole lot. At some point in the future we probably want to do a SmolStr-type split for NixList into a two-variant enum where one side is an Rc<Vec<Value>> for lists longer than a certain length. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I32154d18785a1f663454a8b9d4afd3e78bffdf9c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7040 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-18 r/5157 docs(tvix/eval): upvalues.rs: define "upvalue", comment with_stackAdam Joseph1-9/+30
This commit adds a comment for the benefit of non-Lua-users explaining what an upvalue is. It also adds a comment explaining what `with_stack` does, including a brief reminder of nix's slightly-unusual-but-well-justified handling of this construct. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: If6d0e133292451af906e1c728e34010f99be8c7c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7007 Reviewed-by: j4m3s <james.landrein@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-18 r/5156 fix(tvix/eval): wrap dynamic resolution in an extra thunkVincent Ambo4-3/+16
Without this change it was possible to cause situations (see the new test) in which a `with`-namespace was forced prematurely. Change-Id: I879ea7763b43edc693feace2c73c890d426fafd3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7031 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com>
2022-10-17 r/5155 feat(nix/eval): Implement builtins.functionArgsGriffin Smith4-0/+100
Now that we're tracking formals on Lambda this ends up being quite easy; we just pull them off of the Lambda for the argument closure and use them to construct the result attribute set. Change-Id: I811cb61ec34c6bef123a4043000b18c0e4ea0125 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7003 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-17 r/5154 feat(tvix/eval): Validate closed formalsGriffin Smith7-13/+133
Validate "closed formals" (formal parameters without an ellipsis) via a new ValidateClosedFormals op, which checks the arguments (in an attr set at the top of the stack) against the formal parameters on the Lambda in the current frame, and returns a new UnexpectedArgument error (including the span of the formals themselves!!) if any arguments aren't allowed Change-Id: Idcc47a59167a83be1832a6229f137d84e426c56c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7002 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-17 r/5153 feat(tvix/eval): Record formals on lambdaGriffin Smith4-13/+42
In preparation for both implementing the `functionArgs` builtin and adding support for validating closed formals, record information about the formal arguments to a function *on the Lambda itself*. This may seem a little odd for the purposes of just closed formal checking, but is something we have to have anyway for builtins.functionArgs so I figured I'd do it this way to kill both birds with one stone. Change-Id: Ie3770a607bf352a1eb395c79ca29bb25d5978cd8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7001 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-17 r/5152 feat(tvix/eval): Implement builtins.seqGriffin Smith4-0/+8
Since we already have infra for forcing arguments to builtins, this ends up being almost *too* simple - we just return the second argument! Change-Id: I070d3d0b551c4dcdac095f67b31e22e0de90cbd7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6999 Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-17 r/5151 docs(tvix/eval) comments for various fieldsAdam Joseph3-5/+27
Change-Id: I8dcddf2b419761e475e71215c199eef2f7dc61dc Reviewed-on: https://cl.tvl.fyi/c/depot/+/7028 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-16 r/5150 refactor(tvix/eval): unify compile_lambda() with thunk()Adam Joseph1-61/+59
This resolves a TODO. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: If4d2124648ac88094e547e1ad7f1b446feb26182 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7010 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-16 r/5149 fix(tvix/eval): more faithfully serialise ast::LiteralVincent Ambo1-10/+9
The previous serialisation format kind of lost the information about what AST node we're dealing with (e.g. `1234` would serialise to an AST with a literal `1234`). That's great for pretty-printing the _code_, but we explicitly want to serialise how rnix-parser parses something. To that end, literals are now instead serialised into a structure like all the other ones (`kind: literal` and appropriate value fields). Change-Id: I586c95d7db41820b8ec43565ba4016ed3834d1b5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7030 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: j4m3s <james.landrein@gmail.com> Reviewed-by: Adam Joseph <adam@westernsemico.com>
2022-10-16 r/5148 feat(tvix/eval): implement builtins.partitionJames Landrein3-0/+39
Change-Id: I8b591f3057c68c1542046fc5a771973f2238c9df Reviewed-on: https://cl.tvl.fyi/c/depot/+/7020 Autosubmit: j4m3s <james.landrein@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-16 r/5147 fix(tvix/eval): resolve home relative paths at runtimesterni3-12/+31
Home relative paths depend on the environment to be resolved. We have elected to do everything that depends on the environment, e.g. resolving SPATH expressions using NIX_PATH, at runtime, so tvix evaluation would continue to behave correctly even if we separated the compilation and execution phases more, e.g. via serializing bytecode. Then the value of HOME, NIX_PATH etc. could reasonably change in the time until execution, yielding wrong results if the resolution results were cached in the bytecode. We also take the opportunity to fix the broken path concatenation previously found in the compiler, fixing b/205. Another thing we could consider is emitting a warning for home relative path literals, as they are by nature relatively fragile. One sideeffect of this change is that home path resolution errors become catchable which is not the case in C++ Nix. This will need to be fixed up in a subsequent change. Change-Id: I30bd69b575667c49170a9fdea23a020565d0f9ec Reviewed-on: https://cl.tvl.fyi/c/depot/+/7024 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2022-10-16 r/5146 refactor(tvix/eval): make OpFindFile use internal UnresolvedPathsterni3-12/+22
To assert that OpFindFile is only emitted for specially compiled SPATH expressions, as well as make sure it doesn't accidentally operate on “ordinary values”, introduce an UnresolvedPath internal value. If OpFindFile sees a non-UnresolvedPath value, it'll crash. Note that this change is not done purely for OpFindFile: We may want to compile SPATH expressions as function calls to __findFile (like C++ Nix does) in the future, so the UnresolvedPath value would definitely need to be an ordinary string again then. Rather, this change is done in preparation for resolving home dir relative paths at runtime (since they depend on the environment) for which we'll need a similar mechanism to OpFindFile. Change-Id: I6acf287f35197cd9e13377079f972b9d36e5b22e Reviewed-on: https://cl.tvl.fyi/c/depot/+/7023 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-16 r/5145 refactor(tvixbolt): use details elements for toggling outputsVincent Ambo2-36/+70
For optional outputs (runtime trace & AST) this has a slightly nicer user experience. Note that the code of this is a bit verbose because doing a naive implementation hits dumb behaviours of browsers that result in infinite loops. Thanks Profpatsch for the suggestion. Change-Id: I8945a8e722f0ad8735829807fb5e39e2101f378c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7006 Reviewed-by: j4m3s <james.landrein@gmail.com> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-16 r/5144 feat(tvixbolt): add toggle for displaying pretty-printed ASTVincent Ambo1-2/+26
This uses the JSON serialisation of the AST introduced earlier to display a text box with the serialised AST to users. Useful for debugging. Change-Id: Ibc400eaf5ca87fa5072d5c044942505331c3bb40 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7005 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-16 r/5143 feat(tvix/eval): add an AST pretty-printing moduleVincent Ambo6-2/+503
This implements serde::Serialize for the rnix AST through a wrapper type, and exposes a function for serialising the AST into a (pretty-printed JSON) string representation. This can be used to debug issues with the AST, and to display an AST reprsentation in tools like tvixbolt. Serialize is implemented manually because we don't own any of the structs and the way to traverse them is not easily derived automatically, and this is quite verbose. We might be able to condense it a little bit, but at the same time it's also fairly straightforward. Change-Id: I922df43cfc25636f3c8baee7944c75ade516055c Reviewed-on: https://cl.tvl.fyi/c/depot/+/6943 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-16 r/5142 feat(tvix/eval): remove Clone instance from Chunk and LambdaAdam Joseph2-2/+2
Lambda has a quite large and variable-sized runtime representation, unlike Rc<Lambda>. It would be easy to accidentally call clone() on this and create input-dependent performance regressions. Nothing in the codebase is currently using Lambda.clone(). Let's remove the derived instance. If it's really needed it is very easy to add it back in, but whoever does that will have to look at the struct they're adding Clone to, which will hopefully prompt them to think about whether or not that's really what they want to do. Change-Id: I7806a741862ab4402229839ce3f4ea75aafd6d12 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7029 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-16 r/5141 fix(tvix/eval): don't coerce variable name to stringsterni2-3/+4
Change-Id: I8aa878dee009901feb453c489ce37c12fa3a31a8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7026 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-16 r/5140 refactor(tvix/eval) remove Value::DynamicUpvalueMissingAdam Joseph2-10/+1
I believe this variant is left over from a previous implementation. If not, please let me know. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I02a3bf2f63794d09e96a5a92a034c0ad3d1ff221 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7027 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5139 feat(wpcarro/ava): Set initialPasswordWilliam Carroll1-0/+1
This is useful when first setting up a device. Call `passwd` afterwards to imperatively change the password. Change-Id: I070f1cfaf05a38844ee363be4d511035e77096d6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7013 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2022-10-15 r/5138 feat(wpcarro/gitconfig): Set push.default to currentWilliam Carroll1-0/+2
Also: - move to `dotfiles` subdir - rename .gitignore -> gitignore Change-Id: I098aef39ba3415de54812d4d36f8672b0e094c86 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7012 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
2022-10-15 r/5137 feat(tvix/eval): Implement builtins.intersectAttrsGriffin Smith3-0/+19
Change-Id: Iaba9bcfa19f283cd0c1931be2f211e2528a1a940 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6998 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2022-10-15 r/5136 feat(tvix/eval): Initial impl of builtins.matchGriffin Smith6-0/+96
Implement an *initial* version of builtins.match, using the rust `regex` crate for regular expressions. The rust regex crate definitely has different semantics than nix's regular expressions - but we'd like to see how far we can get before the incompatibility starts to matter. This consciously leaves out any sort of memo for compiled regular expressions (which upstream nix also has) for the sake of expediency - in the future we should implement that so we don't have to compile the same regular expression multiple times. Change-Id: I5b718635831ec83397940e417a9047c4342b6fa1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6989 Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5135 feat(tvix/eval): Implement builtins.fromJSONGriffin Smith12-13/+123
Using `serde_json` for parsing JSON here, plus an `impl FromJSON for Value`. The latter is primarily to stay "dependency light" for now - likely going with an actual serde `Deserialize` impl in the future is going to be way better as it allows saving significantly on intermediary allocations. Change-Id: I152a0448ff7c87cf7ebaac927c38912b99de1c18 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6920 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5134 chore(tvix): fix vscode rust-analyzer recommendationProfpatsch1-1/+1
They renamed the thing. Change-Id: If8b9a05581c684793dd42ce4880901c0be3c4b98 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7021 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5133 fix(tvix/eval): bring foldl' strictness in line with C++ Nixsterni7-2/+16
Working on https://github.com/NixOS/nix/pull/7158, I discovered that C++ Nix actually is strict in the accumulator, just not in the first value. This seems due to the fact that in the C++ evaluator, function calls don't seem to be thunked unconditionally and foldl' just elects not to wrap it in a thunk (don't quote me on this summary, even though it seems to line up with the code for primop_foldlStrict and testable behavior). It doesn't seem worth it to risk breaking the odd Nix expression just to be strict in one more value per invocation of foldl' (i.e. the initial accumulator value `nul`), so let's match the existing C++ Nix behavior here. Change-Id: If59e62271a90d97cb440f0ca72a58ec7840d1690 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7022 Autosubmit: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-15 r/5132 feat(tvix/eval): implement builtins.dirOfAdam Joseph4-0/+27
This commit causes the test eval-okay-builtins.nix to pass. It also adds tests/tvix_tests/eval-okay-dirof.nix which has better coverage than the nix tests for this builtin. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I71d96b48680696fd6e4fea3a9861742b35cfaa66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6987 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-14 r/5131 docs(tvix/eval) vm: explain VM::{frames,stack,with_stack}Adam Joseph1-2/+12
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I94ba31ae25c1ff744f929a722c76a0c33cc361ff Reviewed-on: https://cl.tvl.fyi/c/depot/+/7016 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-14 r/5130 feat(tvix/eval): implement builtins.toPathAdam Joseph1-6/+9
This commit implements builtins.toPath. Like OP_ADD, it currently does not handle string contexts. This commit allows the tests::nix_eval_okay_src_tests_nix_tests_eval_okay_pathexists_nix test to pass. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: Iadd4f7605f8f297adbd0dba187b8481c21370b6e Reviewed-on: https://cl.tvl.fyi/c/depot/+/6996 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-10-14 r/5129 feat(tvix/eval): eliminate the only `unsafe` in the codebaseAdam Joseph1-4/+2
Maybe I misunderstood this part of the code, but the use of `unsafe` appears unnecessary here? In any event it is the one and only `unsafe` in the codebase. Hopefully getting to "no `unsafe` anywhere" is worth the extra never-taken branch caused by unwrap() instead of unwrap_unchecked()? Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I33fbd5aad9d8307ea82c24b6220412783e1973c6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7011 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-14 r/5128 refactor(tvix/eval): remove OpResolveWithOrUpvalueAdam Joseph2-20/+0
The case branch in vm.rs for OpResolveWithOrUpvalue is unreachable/deadcode. I believe this opcode is unnecessary, since it should always be statically detectable (at parse-time) whether a reference is to an upvalue (i.e. enclosing binding); otherwise, and only then, is with-resolution applicable. Perhaps I've misunderstood how with-resolution works. If so, please explain it to me and -1/-2 this CL. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I4a90b9eb6cb3396df92a6a943d42ecc301871ba0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7009 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-10-14 r/5127 refactor(tvix/eval): order builtins alphabeticallyJames Landrein1-45/+45
This makes it easier to compare currently implemented ones with the full list. Change-Id: Ibaffd99d05afa15fc9ab644fd101afa24fc7a1b2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7008 Tested-by: BuildkiteCI Autosubmit: j4m3s <james.landrein@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su>