about summary refs log tree commit diff
path: root/tvix/nix-compat/src/store_path/mod.rs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-08-19 r/6490 docs(tvix/nix-compat/store_path): fix broken docstr referenceFlorian Klink1-2/+2
Change-Id: Ie95ac265f8707e138c6a7b529760650d211f259d Reviewed-on: https://cl.tvl.fyi/c/depot/+/9087 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
2023-08-19 r/6488 docs(tvix/nix-compat): remove disambiguityFlorian Klink1-2/+2
Don't import thiserror::Error directly, so rustdoc knows what `crate::store_path::Error` we're talking about. Change-Id: I755c9377521a6833e9a77cb1a41b48edafb31fe0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9086 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
2023-07-31 r/6448 feat(nix-compat/store_path): implement PartialOrd and OrdFlorian Klink1-0/+12
This allows sorting Store Paths. We delegate the sorting business to the PartialOrd, Ord impls for our digest fields only, as two StorePaths with the same digest, but different names can't exist. Change-Id: I5f81631e5f5063893b316c63a240c5266b7e5bad Reviewed-on: https://cl.tvl.fyi/c/depot/+/8988 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-21 r/6438 feat(tvix/nix-compat/store_path): store position in InvalidNameFlorian Klink1-4/+4
Add the position in the string where the name is problematic. Change-Id: If6fd8be6100b718f8d68568eafc77ebb3cfb82d0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8979 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
2023-07-21 r/6433 feat(tvix/nix-compat): have StorePath accept bytesFlorian Klink1-53/+65
The primary constructor for this is now from_bytes, from_string is simply calling .as_bytes() on the string, passing it along. The InvalidName error now contains a Vec<u8>, to encode the invalid name (which might not be a string anymore). from_absolute_path now accepts a &[u8] (even though we might want to make this a OSString of some sort). StorePath::validate_name has been degraded to a pub(crate) function. It's still used in src/derivation, even though it probably shouldn't at all - that cleanup is left for cl/8412 though. Change-Id: I6b4e62a6fa5c4bec13b535279e73444f0b83ad35 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8973 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-21 r/6432 feat(tvix/nix-compat): fold NameError into ErrorFlorian Klink1-23/+12
This being a nested error makes things more complicated than necessary. Also, this caused BuildStorePathError to only hold NameError, so refactor these utility functions to either return Error, or BuildStorePathError. Change-Id: I046fb403780cc5135df8b8833a291fc2a90fd913 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8972 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su>
2023-06-10 r/6262 feat(tvix/nix-compat): derive HashFlorian Klink1-1/+1
This allows using a StorePath as a key in a hashmap. Change-Id: Id3eed623da4e1fc44a970a3982c7caa21d2495c8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8666 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-05-16 r/6145 feat(tvix/nix-compat): add StorePath::from_absolute_path_fullFlorian Klink1-2/+75
This allows decomposing a path consisting of a store path AND a suffix into a StorePath, and a PathBuf containing the rest. Change-Id: I81290e2fd804cdc9d1e88c71cb22c0fb882d7936 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8567 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-05-16 r/6144 docs(tvix/nix-compat): update docstringsFlorian Klink1-10/+18
Make it cleaner that StorePath only does encode the first path component after the STORE_DIR prefix. Also, move some of the comments around a bit, so it makes more sense what's using what. Change-Id: Ibb57373a13526e30c58ad561ca50e1336b091d94 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8566 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
2023-05-14 r/6139 refactor(tvix/nix-compat): update expect_err stringsFlorian Klink1-4/+4
Make it more explicit that we expect the from_string calls to fail here. Change-Id: Ib3d46fc0850e364125e3548670ef301eeea2e45c Reviewed-on: https://cl.tvl.fyi/c/depot/+/8565 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-04-09 r/6088 refactor(nix-compat): Properly encapsulate store path constructionJohn Ericson1-10/+20
Before there was code scattered about (e.g. text hashing module and derivation output computation) constructing store paths from low level building blocks --- there was some duplication and it was easy to make nonsense store paths. Now, we have roughly the same "safe-ish" ways of constructing them as C++ Nix, and only those are exposed: - Make text hashed content-addressed store paths - Make other content-addressed store paths - Make input-addressed fixed output hashes Change-Id: I122a3ee0802b4f45ae386306b95b698991be89c8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8411 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-03-30 r/6060 refactor(tvix/nix-compat): move build_store_path out of derivationFlorian Klink1-0/+203
This doesn't have anything to do with ATerms, we just happen to be using the aterm representation of a Derivation as contents. Moving this into store_path/utils.rs makes these things much cleaner - Have a build_store_path_from_references function, and a build_store_path_from_fingerprint helper function that makes use of it. build_store_path_from_references is invoked from the derivation module which can be used to calculate the derivation path. In the derivation module, we also invoke build_store_path_from_fingerprint during the output path calculation. Change-Id: Ia8d61a5e8e5d3f396f93593676ed3f5d1a3f1d66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8367 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI