* Nix Daemon protocol post / Tvix @ 2023-10-30 21:02 Florian Klink 2023-11-16 15:14 ` Ludovic Courtès 0 siblings, 1 reply; 4+ messages in thread From: Florian Klink @ 2023-10-30 21:02 UTC (permalink / raw) To: guix-devel Hey, I stumbled across your post https://guix.gnu.org/blog/2023/a-build-daemon-in-guile/. I'm working on Tvix (https://tvix.dev/), a reimplementation of Nix in Rust. Different components are nicely separated, some of the nix-specific protocols and formats are developed in a independent, intended to be general-purpose `nix-compat` crate that doesn't depend on Tvix itself. All with hopefully comprehensive documentation and a lot of test cases. Tvix can already evaluate bigger chunks of nixpkgs the same way as Nix, and come up with the same calculated output paths :-) Some of the protcols are implemented in a nicer fashion, while providing a Nix-compatible "view" into the system. For example, tvix-store is using a content-addressed merkle storage DAG (tvix-castore) under the hood, allowing partial substitution and store path subtree sharing. However we can still provide a Nix-compatible view into all this, so can synthesize NAR Archives and NARInfo files for a given store path on demand, if we want to. We currently use the HTTP Binary cache protocol as a store interface for Nix (via `nar-bridge`, which spins up a webserver). At some point, we now also want to implement the daemon protocol - both a client and server, to allow talking to Nix more directly - be it a "remote store", or just querying the local Nix store for certain information. This is so far mostly oriented towards store operations (as we didn't do too much work on the Builder interface yet) Nevertheless, I think we should collaborate. Be that: - just a simple exchange of notes about the behaviour of the protocol and certain operations - discussions about designing new protocols, ensuring interop between tvix-store and guix stores (there's some ideas for P2P substitution) - or even collaboration and work on getting tvix-store (and tvix-build, once it's there) to work with a Guile frontend :-) I think we're sharing a lot of common interest and would like to start having these conversations :-) Cheers, flokli Some links: - Tvix status update from NixCon 2023 (https://media.ccc.de/v/nixcon-2023-35254-tvix) - Tvix Website: https://tvix.dev/ - Code: https://code.tvl.fyi/tree/tvix ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Nix Daemon protocol post / Tvix 2023-10-30 21:02 Nix Daemon protocol post / Tvix Florian Klink @ 2023-11-16 15:14 ` Ludovic Courtès 2023-11-16 19:23 ` Ensuring daemon interop, maybe also store layer standardization? John Ericson 0 siblings, 1 reply; 4+ messages in thread From: Ludovic Courtès @ 2023-11-16 15:14 UTC (permalink / raw) To: Florian Klink; +Cc: guix-devel, Christopher Baines Hi Florian, Florian Klink <flokli@flokli.de> skribis: > I stumbled across your post > https://guix.gnu.org/blog/2023/a-build-daemon-in-guile/. > > I'm working on Tvix (https://tvix.dev/), a reimplementation of Nix in > Rust. Neat, thanks for reaching out to us! [...] > For example, tvix-store is using a content-addressed merkle storage DAG > (tvix-castore) under the hood, allowing partial substitution and store > path subtree sharing. > > However we can still provide a Nix-compatible view into all this, so can > synthesize NAR Archives and NARInfo files for a given store path on > demand, if we want to. We currently use the HTTP Binary cache protocol > as a store interface for Nix (via `nar-bridge`, which spins up a > webserver). > > At some point, we now also want to implement the daemon protocol - both > a client and server, to allow talking to Nix more directly - be it a > "remote store", or just querying the local Nix store for certain > information. This is so far mostly oriented towards store operations (as > we didn't do too much work on the Builder interface yet) All this sounds nice. > Nevertheless, I think we should collaborate. > > Be that: > - just a simple exchange of notes about the behaviour of the protocol > and certain operations > - discussions about designing new protocols, ensuring interop between > tvix-store and guix stores (there's some ideas for P2P substitution) > - or even collaboration and work on getting tvix-store (and tvix-build, > once it's there) to work with a Guile frontend :-) > > I think we're sharing a lot of common interest and would like to start > having these conversations :-) That’s a good idea! My take is that the daemon rewrite in Guix will aim for 100% compatibility at the protocol level (in fact part of what’s needed is already available as (guix …) modules), probably with just the same feature set. Christopher Baines may have clearer ideas. I’m interested in hearing how you view content-addressing and its use. In Guix there’s one proposal based on ERIS: https://issues.guix.gnu.org/52555#8 Previously there was an experiment to implement what you described at “partial substitution”: https://lists.gnu.org/archive/html/guix-devel/2021-01/msg00080.html Hot topics! :-) Thanks, Ludo’. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Ensuring daemon interop, maybe also store layer standardization? 2023-11-16 15:14 ` Ludovic Courtès @ 2023-11-16 19:23 ` John Ericson 2023-11-16 20:52 ` Florian Klink 0 siblings, 1 reply; 4+ messages in thread From: John Ericson @ 2023-11-16 19:23 UTC (permalink / raw) To: guix-devel, Ludovic Courtès, Christopher Baines Cc: Florian Klink, Valentin Gagarin, Maxim Cournoyer [-- Attachment #1: Type: text/plain, Size: 5475 bytes --] On Thu, Nov 16, 2023, at 10:14 AM, Ludovic Courtès wrote: > My take is that the daemon rewrite in Guix will aim for 100% > compatibility at the protocol level (in fact part of what’s needed is > already available as (guix …) modules), probably with just the same > feature set. Christopher Baines may have clearer ideas. Excellent! I am glad that Florian already emailed about this, I had similar thoughts. I have long been a proponent of ensuring interoperability in the "store layer" between Nix, Guix, Tvix, and anyone else that wants to have an implementation. (To me, the daemon is just one possible implementation, an RPC bridge to another implementation.) There are some good developments on the Nix side in this space I've been meaning to email this mailing list about. Glad the recent guix-daemon work and ensuing discussion are finally getting me to do so! Here they are: • RFC 134 https://github.com/NixOS/rfcs/blob/master/rfcs/0134-nix-store-layer.md: this is the linchpin holding a few things together on the Nix side. Nix gone back and forth over the years emphasizing the degree to which the store layer beneath the Nix language is self-contained and can be used/understood on its own. With that RFC we're finally committing to "show off the store layer" as official policy. • https://nixos.org/manual/nix/unstable/store/ there is a new top-level section of the Nix manual that is commentating the store-layer. Expect it to grow rapidly in the coming months as new information is written, and existing information that belongs here but is tagging along elsewhere is moved here. • Unit tests with external data "golden masters" for serializes for the daemon protocol https://github.com/NixOS/nix/tree/master/unit-test-data/libstore/worker-protocol, and derivation ATerm format https://github.com/NixOS/nix/tree/master/unit-test-data/libstore/derivation. (Since the Guix fork I've tried to systematize the daemon protocol with bidirectional serializers for explicit data types, which the RPC layer uses.) The test data is separate files with the explicit intention of making them easy to reuse in other implementations :), as opposed to just in-code string/binary literals which would be very inconvenient for them. • https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-derivation-add making sure the JSON derivation format is round-tripable with a new command, for ease of use and in hopes that we might someday ditch "ATerm" for the on-disk format for everyone's benefit. • https://github.com/NixOS/nix/pull/8699 C bindings for the Nix store. Perhaps this isn't so important now that you all are going for the full rewrite, but I saw Maxim's early email about creating guile bindings for a gradual rewrite. The C bindings are explicitly made with the idea of making other langauge bindings easier (e.g. https://github.com/NixOS/nix/pull/7735, https://hackage.haskell.org/package/hercules-ci-cnix-store). Still mentioning this in case it is useful as a "Plan B". Furthermore, I hope that beyond merely ensuring some interop with what we have already, we work to further keep things in sync and hopefully converging (where was have diverging new features like Blake hashing in Guix and content-addressed derivations in Nix) going forward. To that end, I would love to set up an implementation-agnostic standard, maybe even an IETF standard (!). I think while we all have different ideas (and should continue to have different ideas!) on what the user-facing package language looks like, we do essential agree on what this store interface looks like. It is a "narrow waist" which can be implemented numerous different ways, and used in numerous different high level packaging paradigms. It is this quality that makes it so worthy of standardization. > I’m interested in hearing how you view content-addressing and its use. > In Guix there’s one proposal based on ERIS: > > https://issues.guix.gnu.org/52555#8 > > Previously there was an experiment to implement what you described at > “partial substitution”: > > https://lists.gnu.org/archive/html/guix-devel/2021-01/msg00080.html I have been talking a lot to Florian about these things too. Long ago I emailed Ludo and some others about the IPFS & Nix work. Since then RFC 133 was accepted, https://github.com/NixOS/rfcs/blob/master/rfcs/0133-git-hashing.md, which prepares the way for a lot of that, and more recently https://github.com/NixOS/nix/pull/9294 (merged) has begun the implementation. It sounds like this ERIS plan and Tvix's content addressing are fairly similar --- use improved content addressing "underneath the hood". The thing I have been working on is trying to expose content-addressing all the way into the store path for end-to-end trustlessless. I think for build artifacts, either way is fine. But for source code the end-to-end trustlessness is nice for treating things like Software Heritage as a substituter of last resort. (I made https://docs.softwareheritage.org/devel/swh-web/uri-scheme-api.html#get--api-1-raw-(swhid)- forto spit out raw git objects for https://blog.obsidian.systems/software-heritage-bridge/, but the pipelining latency issues mean something like SWH's "Vault API" is probably better.) ---------- That's a big wall of text, but glad it's all out there. Stuff is really cooking in all our ecosystems these days, and I'm very excited for where things are going! John [-- Attachment #2: Type: text/html, Size: 7344 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ensuring daemon interop, maybe also store layer standardization? 2023-11-16 19:23 ` Ensuring daemon interop, maybe also store layer standardization? John Ericson @ 2023-11-16 20:52 ` Florian Klink 0 siblings, 0 replies; 4+ messages in thread From: Florian Klink @ 2023-11-16 20:52 UTC (permalink / raw) To: John Ericson Cc: guix-devel, Ludovic Courtès, Christopher Baines, Valentin Gagarin, Maxim Cournoyer On 23-11-16 14:23:29, John Ericson wrote: >On Thu, Nov 16, 2023, at 10:14 AM, Ludovic Courtès wrote: >I have been talking a lot to Florian about these things too. Long ago I >emailed Ludo and some others about the IPFS & Nix work. Since then RFC >133 was accepted, >https://github.com/NixOS/rfcs/blob/master/rfcs/0133-git-hashing.md, >which prepares the way for a lot of that, and more recently >https://github.com/NixOS/nix/pull/9294 (merged) has begun the >implementation. > >It sounds like this ERIS plan and Tvix's content addressing are fairly >similar --- use improved content addressing "underneath the hood". The >thing I have been working on is trying to expose content-addressing all >the way into the store path for end-to-end trustlessless. tvix-castore uses /only/ the BLAKE3 digest, and thanks to its verified streaming properties, chunking parameters etc don't "bleed" into the to-be-signed datastructure (and its content hash), but can be delivered (and verified) out-of-band, without having to fetch the entire data. That's also one of the main reasons as to why Iroh (The IPFS Rust "Rewrite") entirely ditched IPLD and all other hash functions in favor of raw blake3-hashed blobs [1]), and why they, S5 [2] and Tvix uses them to address blobs. Among these projects, there's different areas of priority and focus, but strictly speaking, they're all just different transport protocols for the same identifier (blake3 digests of raw contents) and could interop with each other. For file system structures, tvix-castore also defines an encoding similar to git trees, but using the blake3 digest of (a slightly more sane) serialization as an identifier. ERIS defines its own addressing scheme, using "ERIS capability URNs", and in addition to the contents, chunksize (two modes) and convergence secret make up the identifier. Internally, it constructs its own Merkle Tree using ChaCha20 and Blake2b-256. https://issues.guix.gnu.org/52555 uses it with the larger chunk size and a null convergence secret. >I think for build artifacts, either way is fine. But for source code >the end-to-end trustlessness is nice for treating things like Software >Heritage as a substituter of last resort. (I made >https://docs.softwareheritage.org/devel/swh-web/uri-scheme-api.html#get--api-1-raw-(swhid)- >forto spit out raw git objects for >https://blog.obsidian.systems/software-heritage-bridge/, but the >pipelining latency issues mean something like SWH's "Vault API" is >probably better.) I hope some day SWH will also support looking up blobs not just by their SWHID (which is just using a lot of lipstick to describe how git encodes blobs), but also by these nice new hash functions of the raw contents, which would allow SWH to be plugged as a "last resort" source directly- without having to keep carrying along and calculating additional git-based hashes / SWHIDs to prepare for the eventuality of having to reach out to there. >That's a big wall of text, but glad it's all out there. Stuff is really >cooking in all our ecosystems these days, and I'm very excited for >where things are going! Definitely! -- flokli [1]: https://github.com/n0-computer/iroh/discussions/707 [2]: https://github.com/n0-computer/iroh/discussions/709 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-16 21:27 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-10-30 21:02 Nix Daemon protocol post / Tvix Florian Klink 2023-11-16 15:14 ` Ludovic Courtès 2023-11-16 19:23 ` Ensuring daemon interop, maybe also store layer standardization? John Ericson 2023-11-16 20:52 ` Florian Klink
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/guix.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.