about summary refs log tree commit diff
path: root/tvix/nix-compat (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-09-23 r/6640 fix(tvix/nix-compat): drop first character period checkFlorian Klink1-6/+10
Suggested in https://cl.tvl.fyi/c/depot/+/9108/5, but this disallows adding a .gitignore file to the store. Remove the check, and add a testcase. Change-Id: Ieb78c417934756b2dbeb493040fe79726d1b9079 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9447 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de>
2023-09-23 r/6638 feat(tvix/nix-compat): fix and improve error messageFlorian Klink1-1/+6
Similar to cl/9350. Most of the times, this is still a regular string, so let's print it like that if we can, and resort to base64 encoding if we can't. We were also wrongly always outputting the second character in the string. Change-Id: Id0e2a9d9f1ad3d2d7b554893ecd89a7e6383e9c2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9445 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-09-22 r/6627 chore(tvix): remove some unused crate dependenciesFlorian Klink1-2/+0
Change-Id: I31b0e7be3a2ebc268c6f4045ba282e8fb1c72a64 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9375 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Connor Brewster <cbrewster@hey.com>
2023-09-21 r/6623 refactor(tvix/store): Asyncify PathInfoService and DirectoryServiceConnor Brewster1-1/+1
We've decided to asyncify all of the services to reduce some of the pains going back and for between sync<->async. The end goal will be for all the tvix-store internals to be async and then expose a sync interface for things like tvix eval io. Change-Id: I97c71f8db1d05a38bd8f625df5087d565705d52d Reviewed-on: https://cl.tvl.fyi/c/depot/+/9369 Autosubmit: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-09-04 r/6550 refactor(tvix/{cli,store}): move TvixStoreIO to tvix-cli crateFlorian Klink1-0/+12
This trait is eval-specific, there's no point in dealing with these things in tvix-store. This implements the EvalIO interface for a Tvix store. The proper place for this glue code (for now) is tvix-cli, which knows about both tvix-store and tvix-eval. There's one annoyance with this move: The `tvix-store import` subcommand previously also used the TvixStoreIO implementation (because it conveniently did what we wanted). Some of this code had to be duplicated, mostly logic to calculate the NAR-based output path and create the PathInfo object. Some, but potentially more of this can be extracted into helper functions in a shared crate, and then be used from both TvixStoreIO in tvix-cli as well as the tvix-store CLI entrypoint. Change-Id: Ia7515e83c1b54f95baf810fbd8414c5521382d40 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9212 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
2023-08-20 r/6513 docs(tvix/nix-compat/nixhash): update commentsFlorian Klink1-4/+6
Change-Id: I46660da84065fd6938f581e14d67e231dca3c3ea Reviewed-on: https://cl.tvl.fyi/c/depot/+/9112 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-08-20 r/6512 refactor(tvix/nix-compat/nixhash): validate digest lengthsFlorian Klink5-38/+87
There was a NixHash::new() before, which didn't perform any validation of the digest length. We had some length validation when parsing nix hashes or SRI hashes, but some places didn't perform validation and/or constructed the struct directly. Replace NixHash::new() with a `impl TryFrom<(HashAlgo, Vec<u8>)> for NixHash`, which does do this validation, and update constructing code to use that, rather than populating structs directly. In some rare cases where we're sure the digest length is correct we still populate the struct manually. Fixes b/291. Change-Id: I7a323c5b18d94de0ec15e391b3e7586df42f4229 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9109 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-08-20 r/6511 refactor(tvix/nix-compat): cargo clippyFlorian Klink1-8/+8
Change-Id: I1c1608a6e75e451940fe1c61dc5ace5f0e7d7752 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9111 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-08-20 r/6495 fix(tvix/nix-compat): disallow empty derivation namesRyan Lahfa1-0/+10
Yes: ``` $ nix-build -E 'derivation { name = ""; builder = "/bin/sh"; system = "x86_64-linux"; }' error: store path 'nr7i5pf18hw2zg487vkdyrbasdqylfcj-' has an empty name ``` Change-Id: I552f9ed1c1fe3bfceca18ca9b8e13d4b06dc6ff7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9108 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-08-20 r/6494 feat(tvix/nix-compat): don't swallow hash validation errorsRyan Lahfa3-58/+208
Previously, Output deserialization would silence validation errors and provide `None` for `hash_with_mode` as soon as a validation error would happen inside of the `NixHashWithMode` deserialization, e.g. invalid hash length would not provide an validation error but a silent `None` value. This is problematic, we workaround a serde limitation here by writing our own Deserializer. As you can see, we write some boilerplate code unfortunately, as, for example: - `#[serde(fail_if_unparsed_as="Option::is_none")]` is not a thing, otherwise, we could have been able to just bubble up errors in case of "not fully parsed" (and not missing) values. - `From<&serde_json::Value> for serde::de::Unexpected` is not a thing, otherwise, we could just map invalid type errors and reuse the existing types instead of doing extremely bizarre things with `serde::de::Unexpected::Other`, note: this is a not problem for expected, we know what we expect, we don't know what we received in practice. I decided to write a `NixHashWithMode::from_map` which will eat a map deserialized via `serde_json`, so our serde magic is not totally "data model" agnostic. I wanted to go for data model agnosticity and enable maximal performance, e.g. building the structure as the map values are streamed in the Visitor, this is needlessly painful because `Output` and `NixHashWithMode` are in different files and this really makes sense only if we write the full implementation in one file, indeed, otherwise, you end up duplicating the work or having strange coupling. So, for now, we will allocate a full map of the fields inside the `Output`, i.e. if any "unknown field" is in that map, we will deserialize it for no reason. Doing it properly, as I repeat it in the code and to flokli at C3Camp 2023, requires to patch serde upstream IMHO. Change-Id: I46fe6ccb8c390c48d6934fd3e3f02a0dfe59557b Reviewed-on: https://cl.tvl.fyi/c/depot/+/9107 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2023-08-19 r/6491 refactor(tvix/nix-compat/derivation): cargo clippyFlorian Klink1-3/+2
This `.into_iter()` call is equivalent to `.iter()` and will not consume the `BTreeMap`. Change-Id: Ie26637ebecb0bea5b09c447cc45ed207f8b50913 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9088 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
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/6489 refactor(tvix/nix-compat/nixhash): use shorthand struct initFlorian Klink1-1/+1
Change-Id: I1e52b752408a70fdb27e3e5c6f3bef5417b3e922 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9085 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de>
2023-08-19 r/6488 docs(tvix/nix-compat): remove disambiguityFlorian Klink2-3/+3
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-08-19 r/6487 refactor(tvix/nix-compat/derivation/escape): move to Vec<u8>Florian Klink2-7/+7
We only need bstr::ByteSlice to be able to use replace, it doesn't need to return a BString. Change-Id: I811948436fb89652e880970c2c05356183f3e439 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9084 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 r/6458 refactor(tvix/nix-compat/derivation/tests): fix typoFlorian Klink1-1/+1
Change-Id: I764232378f79f16c781870d467469db91a2f14d2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9001 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-07-31 r/6457 refactor(tvix/nix-compat): use local write::*;Florian Klink1-15/+17
Change-Id: I43cc1d5b3419255f815490b2e10f05db19e3bffc Reviewed-on: https://cl.tvl.fyi/c/depot/+/9000 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 r/6456 refactor(tvix/nix-compat/test): rename `data` identifierFlorian Klink1-23/+26
Make it more obvious if these are bytes pointing to JSON or ATerm, so we don't get confused. Change-Id: I2402c687b7ba9c05aac20ed63b0df54e4e96a9d8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8998 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 r/6455 refactor(tvix/nix-compat/derivation): drop some useless allocationsFlorian Klink1-6/+3
Change-Id: I85e44e24e9ec3fe4284f02623a1ac7ca9935e554 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8999 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
2023-07-31 r/6454 refactor(tvix/nix-compat/derivation): use writer.write_allFlorian Klink2-8/+10
This is more concise than a io::copy of a Cursor to bytes, and we have everything to be written in memory. Change-Id: I81f34666aa61aef4e16b33423ce4a69c3781efc3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8997 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-07-31 r/6452 refactor(tvix/derivation): move comma writing business upFlorian Klink2-8/+13
write_input_derivations shouldn't need to write a comma to separate it from the previous output from write_outputs. This is better placed in the function calling all of these helper functions. Change-Id: I9ccc440e4665b52369ef39e75151b9a29469ce48 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8995 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-07-31 r/6451 refactor(tvix/nix-compat/derivation): generic write_array_elementsFlorian Klink1-14/+14
We're happy with any &[S], as long as <S: AsRef<[u8]>. This allows passing both strings and &[u8]. Change-Id: If2a80d9b1ee33ba328c9cdab4fa83ca7b98a71e2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8994 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-07-31 r/6450 refactor(tvix/nix-compat/derivation): simplifyFlorian Klink3-64/+51
Let the escape function only take care of string escaping, not quoting. Let write_array_elements always quote and escape strings it consumes. Move the business of writing additional wrapping characters around it to the caller. Change-Id: Ib8dea69c409561b49862c531ba5a3fe6c2f061f8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8993 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-07-31 r/6449 refactor(tvix/nix-compat): support non-unicode DerivationsFlorian Klink10-120/+308
Derivations can have non-unicode strings in their env values, so the ATerm representations are not necessarily String anymore, but Vec<u8>. Change-Id: Ic23839471eb7f68d9c3c30667c878830946b6607 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8990 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> 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-31 r/6446 chore(tvix/nix-compat): drop useless cloneFlorian Klink1-1/+1
HashAlgo implements Copy, no need to clone here. Change-Id: Ief11d2cfbd4fd0cd44224c7ddd575f518edbbd55 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8989 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
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/6436 refactor(tvix/store): use bytes for node names and symlink targetsFlorian Klink1-13/+14
Some paths might use names that are not valid UTF-8. We should be able to represent them. We don't actually need to touch the PathInfo structures, as they need to represent StorePaths, which come with their own harder restrictions, which can't encode non-UTF8 data. While this doesn't change any of the wire format of the gRPC messages, it does however change the interface of tvix_eval::EvalIO - its read_dir() method does now return a list of Vec<u8>, rather than SmolStr. Maybe this should be OsString instead? Change-Id: I821016d9a58ec441ee081b0b9f01c9240723af0b Reviewed-on: https://cl.tvl.fyi/c/depot/+/8974 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
2023-07-21 r/6433 feat(tvix/nix-compat): have StorePath accept bytesFlorian Klink5-63/+76
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 Klink3-36/+24
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-18 r/6161 refactor(tvix/nix-compat): clippyFlorian Klink2-10/+8
Change-Id: Ie5277a5c15d9dfe543ca41fa7c6a1eedf22a9f64 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8593 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-05-10 r/6129 feat(tvix/nix-compat/nar/writer): check for more data in readerFlorian Klink1-1/+14
We already returned UnexpectedEof in case the reader stopped returning bytes too early, but similarly we should also fail if there's still bytes left to be read in the reader passed. We normally use the NAR writer to produce new NAR files, so the readers point to the blobs we actually want to render, and having some data left in there should be an error. If for some reason the reader points to more data than just the blob, the `.take` method can be used to limit it to the (known) size. Change-Id: I9e8fa0a6dd9c794492abb6dc9e55995e619cb3bb Reviewed-on: https://cl.tvl.fyi/c/depot/+/8553 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-04-09 r/6088 refactor(nix-compat): Properly encapsulate store path constructionJohn Ericson7-112/+257
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-31 r/6069 refactor(nix-compat): Avoid encoding round tripJohn Ericson1-6/+10
When building store paths we can just construct the thing. Change-Id: Ife5d461d6a440ecbb22f32a86a6d51d212a2035b Reviewed-on: https://cl.tvl.fyi/c/depot/+/8409 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-03-31 r/6068 refactor(nix-compat) Make `nixhash_*` mods hierarchicalJohn Ericson4-4/+5
They can go under `nixhash` Change-Id: Ia15835c57130b66d58f5df80ae9595dceee00941 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8408 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2023-03-31 r/6067 refactor(tvix/nix-compat): Inline `texthash` modJohn Ericson3-44/+40
It is moved into `store_path::utils` with the other path builders. Change-Id: I3257170e442af5d83bcf79e63fa7387dd914597c Reviewed-on: https://cl.tvl.fyi/c/depot/+/8410 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 Klink7-142/+156
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
2023-03-30 r/6059 refactor(tvix/nix-compat): use Sha256::new_with_prefixFlorian Klink1-2/+1
Change-Id: I328983008c0680e0448ccff604dbdae312f7988b Reviewed-on: https://cl.tvl.fyi/c/depot/+/8366 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-03-30 r/6058 refactor(tvix/nix-compat): drop is_derivation in build_store_pathFlorian Klink2-12/+7
This only added a suffix to the input argument, if build_store_path was building the path of a Derivation. As we need to also add the `.drv` suffix to the name we pass into text_hash_string inside calculate_derivation_path, we can simply add the suffix there and drop the parameter from build_store_path. Change-Id: Icd5343dd1458f112b9296b389e81ce2ebdd16a9f Reviewed-on: https://cl.tvl.fyi/c/depot/+/8365 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-03-30 r/6057 refactor(tvix/nix-compat): add text_hash_string functionFlorian Klink4-60/+58
Use it to calculate the text_hash_string, which is then used in the calculate_derivation_path and path_with_references functions. Relates to b/263. Change-Id: I7478825e2a23a11224212fea5e3fd06daa97d5e5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8364 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2023-03-30 r/6056 refactor(tvix/nix-compat): move HashAlgo to separate fileFlorian Klink3-38/+42
… and keep the pub exports as is. Change-Id: I2ad21660577553395f05b5ba71083626429b0dfc Reviewed-on: https://cl.tvl.fyi/c/depot/+/8363 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
2023-03-30 r/6055 refactor(tvix/nix-compat): move NixHashWithMode into separate fileFlorian Klink3-108/+114
… and keep the pub exports as is. Change-Id: I9f89a738c508c478ddba61303c21ea294f01ee9f Reviewed-on: https://cl.tvl.fyi/c/depot/+/8362 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su>
2023-03-15 r/6012 refactor(tvix/nix-compat): remove get_fixed_output() funcFlorian Klink1-66/+52
The behaviour of this function is a bit unintuitive, and cl/8310 already inlined the other consumer of it. Rewrite the last consumer of the function, so we can drop it. Change-Id: I59c8486037ce3f777667d1d9e4f4a9316d5a0cb9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8311 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-03-15 r/6011 refactor(tvix/nix-compat): simplify fingerprint calculationFlorian Klink1-76/+54
Instead of having two very similar match branches for the FOD and non- FOD case, detect the FOD case while looping over all outputs. In the case of anything other than recursive sha256 FODs, the fingerprint and output path calculation is exactly the same. Change-Id: Ieb6995653d008766e595cf29d7cd4fb1334e33dd Reviewed-on: https://cl.tvl.fyi/c/depot/+/8310 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>
2023-03-15 r/6009 refactor(tvix/nix-compat): -derivation::Hash, +NixHashFlorian Klink6-76/+187
This stops using our own custom Hash structure, which was mostly only used because we had to parse the JSON representation somehow. Since cl/8217, there's a `NixHash` struct, which is better suited to hold this data. Converting the format requires a bit of serde labor though, but that only really matters when interacting with JSON representations (which we mostly don't). Change-Id: Idc5ee511e36e6726c71f66face8300a441b0bf4c Reviewed-on: https://cl.tvl.fyi/c/depot/+/8304 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2023-03-14 r/6000 refactor(tvix/nix-compat): rename helper funcFlorian Klink1-3/+3
This only trims the output paths from a Derivation struct, not the output hashes. Change-Id: I9250fec4602ed05bb64540c4a89ddb6fb052be1f Reviewed-on: https://cl.tvl.fyi/c/depot/+/8303 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: flokli <flokli@flokli.de>