about summary refs log tree commit diff
path: root/tvix/derivation/src/derivation.rs
AgeCommit message (Collapse)AuthorFilesLines
2023-01-07 r/5623 feat(tvix/derivation): derive Default for DerivationFlorian Klink1-1/+1
Some of the fields in a Derivation struct stay empty, and manually creating BTreeMap or vec for it is annoying. Derive Default instead, so we can use the defaults instead of writing more by hand. Change-Id: I5d41b4b55c8187cb101eb4266451a470008e0067 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7788 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-01-06 r/5617 refactor(tvix/derivation): use StorePath::to_absolute_path()Florian Klink1-7/+3
Instead of concatenating STORE_DIR manually, use StorePath::to_absolute_path() that does it for us. Change-Id: Ia288851a05b4e339679db268f3dd7924e7b65586 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7782 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-06 r/5616 fix(tvix/derivation): fix build after StorePath renameVincent Ambo1-9/+6
This project was not previously covered by CI (fixed in this commit), so we didn't catch breakage due to a renamed module. This was noticed while rebasing a CL that has a dependency on this crate in its Nix build. Change-Id: Ic48570b9313e5f73e14daab50cf7ea70918c94d1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7778 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-06 r/5613 refactor(tvix/store): rename NixPath to StorePathFlorian Klink1-7/+7
As discussed in #tvl, this is a more common term for it. Change-Id: I9b904222b8c076f82192c9b7f0b42be171614ab7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7776 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-06 r/5610 feat(tvix/derivation): implement output path calculationFlorian Klink1-2/+169
This implement output path calculation for fixed outputs, both fixed- output and non-fixed-output. Change-Id: I0a77b99f2ba6b39467cc5dd589ce152a40387f9a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7761 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: jrhahn <mail.jhahn@gmail.com>
2023-01-06 r/5609 feat(tvix/derivation): add get_fixed_output() helper functionFlorian Klink1-0/+21
This will return the fixed output of a derivation (and its hash), or None if the Derivation is not fixed-output. It will simplify the logic in the output path calculation a bit. Change-Id: I1066cc18ee4fc419421a8c5995c93ba91b35588f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7760 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-06 r/5608 refactor(derivation): return NixPath in calculate_derivation_pathFlorian Klink1-16/+29
This moves all the hash compression logic into a common helper function. Also update the docstring, which said "path" here, which could have been confused with output paths. Change-Id: Iedfb59aeb24f7638afac669dcd18d57b6cfaece2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7759 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-01-04 r/5592 feat(tvix/derivation): derive Clone, Debug, Eq and PartialEqFlorian Klink1-1/+1
This allows juggling with Derivation structs in unit tests, and makes it very easy to compare them for equality. Change-Id: I1faf2ec1eefb1a40fcee3c29f04ec47d29f22691 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7758 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-01-04 r/5590 chore(tvix/derivation): align json serialization with nix outputFlorian Klink1-6/+16
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/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 Klink1-1/+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 Hahn1-1/+70
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 Hahn1-6/+12
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 Hahn1-0/+34
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>