chore(tvix/nar-bridge): move to nar-bridge-go

Make some space for the rust implementation.

Change-Id: I924dc1657be10abe5a11951c3b9de50bae06db19
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11662
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: yuka <yuka@yuka.dev>
This commit is contained in:
Florian Klink 2024-05-14 12:35:55 +02:00 committed by clbot
parent ce1aa10b69
commit 1392913e98
32 changed files with 13 additions and 14 deletions

View file

@ -61,8 +61,7 @@ This folder contains the following components:
* `//tvix/castore` - subtree storage/transfer in a content-addressed fashion * `//tvix/castore` - subtree storage/transfer in a content-addressed fashion
* `//tvix/cli` - preliminary REPL & CLI implementation for Tvix * `//tvix/cli` - preliminary REPL & CLI implementation for Tvix
* `//tvix/eval` - an implementation of the Nix programming language * `//tvix/eval` - an implementation of the Nix programming language
* `//tvix/nar-bridge` * `//tvix/nar-bridge-go` - a HTTP webserver providing a Nix HTTP Binary Cache interface in front of a tvix-store
* `nar-bridge-http`: A HTTP webserver providing a Nix HTTP Binary Cache interface in front of a tvix-store
* `//tvix/nix-compat` - a Rust library for compatibility with C++ Nix, features like encodings and hashing schemes and formats * `//tvix/nix-compat` - a Rust library for compatibility with C++ Nix, features like encodings and hashing schemes and formats
* `//tvix/serde` - a Rust library for using the Nix language for app configuration * `//tvix/serde` - a Rust library for using the Nix language for app configuration
* `//tvix/store` - a "filesystem" linking Nix store paths and metadata with the content-addressed layer * `//tvix/store` - a "filesystem" linking Nix store paths and metadata with the content-addressed layer

View file

@ -43,7 +43,7 @@ Potentially copy some data into tvix-store (via nar-bridge):
``` ```
mg run //tvix:store -- daemon & mg run //tvix:store -- daemon &
$(mg build //tvix:nar-bridge)/bin/nar-bridge-http & $(mg build //tvix:nar-bridge-go)/bin/nar-bridge-http &
rm -Rf ~/.cache/nix; nix copy --to http://localhost:9000\?compression\=none $(mg build //third_party/nixpkgs:hello) rm -Rf ~/.cache/nix; nix copy --to http://localhost:9000\?compression\=none $(mg build //third_party/nixpkgs:hello)
pkill nar-bridge-http; pkill tvix-store pkill nar-bridge-http; pkill tvix-store
``` ```

View file

@ -1,4 +1,4 @@
# //tvix/nar-bridge # //tvix/nar-bridge-go
This exposes a HTTP Binary cache interface (GET/HEAD/PUT requests) for a `tvix- This exposes a HTTP Binary cache interface (GET/HEAD/PUT requests) for a `tvix-
store`. store`.

View file

@ -14,7 +14,7 @@ import (
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
castorev1pb "code.tvl.fyi/tvix/castore-go" castorev1pb "code.tvl.fyi/tvix/castore-go"
narBridgeHttp "code.tvl.fyi/tvix/nar-bridge/pkg/http" narBridgeHttp "code.tvl.fyi/tvix/nar-bridge-go/pkg/http"
storev1pb "code.tvl.fyi/tvix/store-go" storev1pb "code.tvl.fyi/tvix/store-go"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@ -47,7 +47,7 @@ func main() {
log.Fatal("failed to read build info") log.Fatal("failed to read build info")
} }
shutdown, err := setupOpenTelemetry(ctx, "nar-bridge", buildInfo.Main.Version) shutdown, err := setupOpenTelemetry(ctx, "nar-bridge-http", buildInfo.Main.Version)
if err != nil { if err != nil {
log.WithError(err).Fatal("failed to setup OpenTelemetry") log.WithError(err).Fatal("failed to setup OpenTelemetry")
} }

View file

@ -3,7 +3,7 @@
{ depot, pkgs, lib, ... }: { depot, pkgs, lib, ... }:
pkgs.buildGoModule { pkgs.buildGoModule {
name = "nar-bridge"; name = "nar-bridge-go";
src = depot.third_party.gitignoreSource ./.; src = depot.third_party.gitignoreSource ./.;
vendorHash = "sha256-7jugbC5sEGhppjiZgnoLP5A6kQSaHK9vE6cXVZBG22s="; vendorHash = "sha256-7jugbC5sEGhppjiZgnoLP5A6kQSaHK9vE6cXVZBG22s=";

View file

@ -1,4 +1,4 @@
module code.tvl.fyi/tvix/nar-bridge module code.tvl.fyi/tvix/nar-bridge-go
require ( require (
code.tvl.fyi/tvix/castore-go v0.0.0-20231105151352-990d6ba2175e code.tvl.fyi/tvix/castore-go v0.0.0-20231105151352-990d6ba2175e

View file

@ -7,7 +7,7 @@ import (
"net/http" "net/http"
castorev1pb "code.tvl.fyi/tvix/castore-go" castorev1pb "code.tvl.fyi/tvix/castore-go"
"code.tvl.fyi/tvix/nar-bridge/pkg/importer" "code.tvl.fyi/tvix/nar-bridge-go/pkg/importer"
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"
mh "github.com/multiformats/go-multihash/core" mh "github.com/multiformats/go-multihash/core"
nixhash "github.com/nix-community/go-nix/pkg/hash" nixhash "github.com/nix-community/go-nix/pkg/hash"

View file

@ -3,7 +3,7 @@ package http
import ( import (
"net/http" "net/http"
"code.tvl.fyi/tvix/nar-bridge/pkg/importer" "code.tvl.fyi/tvix/nar-bridge-go/pkg/importer"
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"
"github.com/nix-community/go-nix/pkg/narinfo" "github.com/nix-community/go-nix/pkg/narinfo"
"github.com/nix-community/go-nix/pkg/nixbase32" "github.com/nix-community/go-nix/pkg/nixbase32"

View file

@ -9,7 +9,7 @@ import (
"testing" "testing"
castorev1pb "code.tvl.fyi/tvix/castore-go" castorev1pb "code.tvl.fyi/tvix/castore-go"
"code.tvl.fyi/tvix/nar-bridge/pkg/importer" "code.tvl.fyi/tvix/nar-bridge-go/pkg/importer"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

View file

@ -11,7 +11,7 @@ import (
"testing" "testing"
castorev1pb "code.tvl.fyi/tvix/castore-go" castorev1pb "code.tvl.fyi/tvix/castore-go"
"code.tvl.fyi/tvix/nar-bridge/pkg/importer" "code.tvl.fyi/tvix/nar-bridge-go/pkg/importer"
storev1pb "code.tvl.fyi/tvix/store-go" storev1pb "code.tvl.fyi/tvix/store-go"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )

View file

@ -218,7 +218,7 @@ This is useful for people running a Tvix-only system, or running builds on a
In a system with Nix installed, we can't simply manually "extract" things to In a system with Nix installed, we can't simply manually "extract" things to
`/nix/store`, as Nix assumes to own all writes to this location. `/nix/store`, as Nix assumes to own all writes to this location.
In these use cases, we're probably better off exposing a tvix-store as a local In these use cases, we're probably better off exposing a tvix-store as a local
binary cache (that's what `//tvix/nar-bridge` does). binary cache (that's what `//tvix/nar-bridge-go` does).
Assuming we are in an environment where we control `/nix/store` exclusively, a Assuming we are in an environment where we control `/nix/store` exclusively, a
"realize to disk" would either "extract" things from the `tvix-store` to a "realize to disk" would either "extract" things from the `tvix-store` to a

View file

@ -15,7 +15,7 @@ There are several projects within Tvix, such as:
* `//tvix/castore` - subtree storage/transfer in a content-addressed fashion * `//tvix/castore` - subtree storage/transfer in a content-addressed fashion
* `//tvix/cli` - preliminary REPL & CLI implementation for Tvix * `//tvix/cli` - preliminary REPL & CLI implementation for Tvix
* `//tvix/eval` - an implementation of the Nix programming language * `//tvix/eval` - an implementation of the Nix programming language
* `//tvix/nar-bridge` - a HTTP webserver providing a Nix HTTP Binary Cache interface in front of a tvix-store * `//tvix/nar-bridge[-go]` - a HTTP webserver providing a Nix HTTP Binary Cache interface in front of a tvix-store
* `//tvix/nix-compat` - a Rust library for compatibility with C++ Nix, features like encodings and hashing schemes and formats * `//tvix/nix-compat` - a Rust library for compatibility with C++ Nix, features like encodings and hashing schemes and formats
* `//tvix/serde` - a Rust library for using the Nix language for app configuration * `//tvix/serde` - a Rust library for using the Nix language for app configuration
* `//tvix/store` - a "filesystem" linking Nix store paths and metadata with the content-addressed layer * `//tvix/store` - a "filesystem" linking Nix store paths and metadata with the content-addressed layer