chore(tvix/nar-bridge): bump go-nix dependency

nixpath.FromString -> storepath.FromAbsolutePath.

See https://github.com/nix-community/go-nix/pull/113 for details.

Closes: https://b.tvl.fyi/issues/314
Change-Id: I25277fb6006cbbb2a323ffb5809a1be500822a97
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9551
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
Florian Klink 2023-10-05 18:26:30 +03:00 committed by clbot
parent 600815c168
commit 61e5a63fe1
6 changed files with 11 additions and 9 deletions

View file

@ -6,5 +6,5 @@ pkgs.buildGoModule {
name = "nar-bridge"; name = "nar-bridge";
src = depot.third_party.gitignoreSource ./.; src = depot.third_party.gitignoreSource ./.;
vendorHash = "sha256-wEd3CBK7r28U77LpWc0UtbMlihkI7dEdy+ZWtJOBTSs="; vendorHash = "sha256-DiGK6Lb+DA46zjJUZpkMSecF3cVst7KoGhcLG3OxtOc=";
} }

View file

@ -7,7 +7,7 @@ require (
github.com/go-chi/chi v1.5.4 github.com/go-chi/chi v1.5.4
github.com/go-chi/chi/v5 v5.0.7 github.com/go-chi/chi/v5 v5.0.7
github.com/google/go-cmp v0.5.9 github.com/google/go-cmp v0.5.9
github.com/nix-community/go-nix v0.0.0-20230825195510-c72199eca18e github.com/nix-community/go-nix v0.0.0-20231005143722-b0f8b73c06df
github.com/sirupsen/logrus v1.9.0 github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.1 github.com/stretchr/testify v1.8.1
google.golang.org/grpc v1.51.0 google.golang.org/grpc v1.51.0

View file

@ -53,6 +53,8 @@ github.com/multiformats/go-varint v0.0.6 h1:gk85QWKxh3TazbLxED/NlDVv8+q+ReFJk7Y2
github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
github.com/nix-community/go-nix v0.0.0-20230825195510-c72199eca18e h1:15CPg2PQMyBl+TTEKuonrQqS9uOJyi7JcuU0FpvV088= github.com/nix-community/go-nix v0.0.0-20230825195510-c72199eca18e h1:15CPg2PQMyBl+TTEKuonrQqS9uOJyi7JcuU0FpvV088=
github.com/nix-community/go-nix v0.0.0-20230825195510-c72199eca18e/go.mod h1:y3eASc0gMh26jjoP9Xz+qqMKjTnqJgG1RG8xvKvFR8s= github.com/nix-community/go-nix v0.0.0-20230825195510-c72199eca18e/go.mod h1:y3eASc0gMh26jjoP9Xz+qqMKjTnqJgG1RG8xvKvFR8s=
github.com/nix-community/go-nix v0.0.0-20231005143722-b0f8b73c06df h1:n4I26uXUST5vmdsDWPo9ikK57il4htQyhnsLWoHYFmY=
github.com/nix-community/go-nix v0.0.0-20231005143722-b0f8b73c06df/go.mod h1:hHM9UK2zOCjvmiLgeaW4LVbOW/vBaRWFJGzfi31/slQ=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

View file

@ -19,7 +19,7 @@ import (
"github.com/nix-community/go-nix/pkg/narinfo" "github.com/nix-community/go-nix/pkg/narinfo"
"github.com/nix-community/go-nix/pkg/narinfo/signature" "github.com/nix-community/go-nix/pkg/narinfo/signature"
"github.com/nix-community/go-nix/pkg/nixbase32" "github.com/nix-community/go-nix/pkg/nixbase32"
"github.com/nix-community/go-nix/pkg/nixpath" "github.com/nix-community/go-nix/pkg/storepath"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
@ -92,7 +92,7 @@ func renderNarinfo(
} }
narInfo := narinfo.NarInfo{ narInfo := narinfo.NarInfo{
StorePath: path.Join(nixpath.StoreDir, string(nodeName)), StorePath: path.Join(storepath.StoreDir, string(nodeName)),
URL: "nar/" + nixbase32.EncodeToString(narHash.Digest()) + ".nar", URL: "nar/" + nixbase32.EncodeToString(narHash.Digest()) + ".nar",
Compression: "none", // TODO: implement zstd compression Compression: "none", // TODO: implement zstd compression
NarHash: narHash, NarHash: narHash,

View file

@ -9,7 +9,7 @@ import (
"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"
"github.com/nix-community/go-nix/pkg/nixpath" "github.com/nix-community/go-nix/pkg/storepath"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
@ -82,7 +82,7 @@ func registerNarinfoPut(s *Server) {
// the bytes in pathInfo.References, and the full strings in pathInfo.Narinfo.ReferenceNames. // the bytes in pathInfo.References, and the full strings in pathInfo.Narinfo.ReferenceNames.
referencesBytes := make([][]byte, 0) referencesBytes := make([][]byte, 0)
for _, reference := range narInfo.References { for _, reference := range narInfo.References {
np, err := nixpath.FromString(path.Join(nixpath.StoreDir, reference)) storePath, err := storepath.FromString(reference)
if err != nil { if err != nil {
log.WithField("reference", reference).WithError(err).Error("unable to parse reference") log.WithField("reference", reference).WithError(err).Error("unable to parse reference")
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
@ -93,7 +93,7 @@ func registerNarinfoPut(s *Server) {
return return
} }
referencesBytes = append(referencesBytes, np.Digest) referencesBytes = append(referencesBytes, storePath.Digest)
} }
// assemble the []*storev1pb.NARInfo_Signature{} from narinfo.Signatures. // assemble the []*storev1pb.NARInfo_Signature{} from narinfo.Signatures.

View file

@ -16,7 +16,7 @@ import (
mh "github.com/multiformats/go-multihash/core" mh "github.com/multiformats/go-multihash/core"
"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"
"github.com/nix-community/go-nix/pkg/nixpath" "github.com/nix-community/go-nix/pkg/storepath"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/ulikunitz/xz" "github.com/ulikunitz/xz"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
@ -246,7 +246,7 @@ func (p *PathInfoServiceServer) Get(ctx context.Context, getPathInfoRequest *sto
// set the root node name to the basename of the output path in the narInfo. // set the root node name to the basename of the output path in the narInfo.
// currently the root node has no name yet. // currently the root node has no name yet.
outPath, err := nixpath.FromString(narInfo.StorePath) outPath, err := storepath.FromAbsolutePath(narInfo.StorePath)
if err != nil { if err != nil {
// unreachable due to nixpath.Check() // unreachable due to nixpath.Check()
panic(err) panic(err)