about summary refs log tree commit diff
path: root/tvix/derivation (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-01-04 r/5590 chore(tvix/derivation): align json serialization with nix outputFlorian Klink11-103/+113
Use the #[serde(rename = "…")] field attributes to match the field names that Nix uses in its JSON output (nix show-derivation). This allows us to just re-use the exact same fixtures from go-nix, without manual post-massaging. Change-Id: Ifd5c08e43cd4f50d5e02903eccd8cb37230b70a6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7757 Reviewed-by: jrhahn <mail.jhahn@gmail.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5589 refactor(tvix/derivation): make output hashes an Option<Hash>Florian Klink2-29/+35
This conveys better if an output of a Derivation is fixed-output or not, and provides a Hash struct that can be used to store the algo and digest. In case it's not, this can simply be None. The serde field attributes have been updated to still accept the same JSON. We currently still store the hash algo and digest as strings, mostly because the only thing populating it so far is the example JSONs. We might want to update this, once actual Nix code populates this. While updating write.rs, I pushed some of the Vec<String> to [&str] conversions inline, and made it a Vec<&str>, because it was annoying to juggle with. Change-Id: Ia9cd0568fe179ac22a4a636237f22ab4ad92b95b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7746 Tested-by: BuildkiteCI Reviewed-by: jrhahn <mail.jhahn@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5588 feat(tvix/derivation): make struct members publicFlorian Klink1-7/+7
Allow others to peek into values. We should probably still restrict this further at a later point. Change-Id: I2831432038aa87c3c7dcc85af4fa76a4fe0eadff Reviewed-on: https://cl.tvl.fyi/c/depot/+/7745 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-04 r/5587 refactor(tvix/derivation): use tvix_store::nixpath::STORE_DIRFlorian Klink2-2/+4
There's now a common constant for this, so we don't need to redefine it here. Change-Id: I48b096f5e623e5fc5bbd355db83b674766935f94 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7753 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5580 feat(tvix/derivation): add nix drv path generation to DerivationJürgen Hahn6-4/+114
This adds a function to generate the derivation path. The computation is based on the Go implementation. Change-Id: Iae89db4976f5fd9208f0453f73688689a245cd66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7729 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-04 r/5579 docs(feat/derivation): add docstring to formatterJürgen Hahn1-0/+1
This is just to clarify that the formatted result is the ATerm representation Change-Id: I98fd0b1d2daa3cf6fdbe526ae1e0bd100ff62df3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7742 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-01-04 r/5577 feat(tvix/derivation) Add fmt::Display implementation for DerivationJürgen Hahn3-22/+42
This adds the implementation of fmt::Display for Derivation so that we can easily store the formatted content as a string. Internally, we use the serialization function to generate the string. Change-Id: I6caca0d6c1bea3ca44b6c535c5b1d5d66d8413b7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7741 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-01-02 r/5564 refactor(tvix/derivation): refactor the derivation serializationJürgen Hahn6-215/+248
This refactors the code to serialize a derivation. The original code has beed moved to seperate crates for better code structure. Change-Id: I3b1a6b134428fcbc9930c330bced8ec3610cfb4c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7733 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2022-12-29 r/5536 feat(tvix/derivation): serialize Nix DerivationJürgen Hahn19-0/+444
This adds a Derivation structure and allows to write it to a structure that implements std::fmt:Write. The implementation is based on the go-nix version. Change-Id: Ib54e1202b5c67f5d206b21bc109a751e971064cf Reviewed-on: https://cl.tvl.fyi/c/depot/+/7659 Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI