depotwide: cleanup after tvl bump
This commit is contained in:
parent
a291c8690a
commit
216fa5f709
4 changed files with 46 additions and 93 deletions
15
third_party/default.nix
vendored
15
third_party/default.nix
vendored
|
@ -35,6 +35,8 @@ let
|
|||
rev = "e0fe990b478a66178a58c69cf53daec0478ca6f9";
|
||||
sha256 = "sha256:0qjyfmw5v7s6ynjns4a61vlyj9cghj7vbpgrp9147ngb1f8krz2c";
|
||||
};
|
||||
|
||||
tvlDepot = import ./tvl { nixpkgsBisectPath = ./nixpkgs; };
|
||||
in
|
||||
rec {
|
||||
inherit nixpkgsConfig nixpkgs;
|
||||
|
@ -60,14 +62,13 @@ rec {
|
|||
};
|
||||
};
|
||||
readTree = import ./tvl/nix/readTree {};
|
||||
gopkgs = readTree ch ./gopkgs;
|
||||
|
||||
bat_syntaxes = import ./tvl/third_party/bat_syntaxes { pkgs = ch.depot.pkgs; };
|
||||
cheddar = import ./tvl/tools/cheddar {
|
||||
pkgs = ch.depot.pkgs // {
|
||||
inherit naersk bat_syntaxes;
|
||||
};
|
||||
gopkgs = readTree {
|
||||
args = ch;
|
||||
path = ./gopkgs;
|
||||
};
|
||||
|
||||
bat_syntaxes = tvlDepot.third_party.bat_syntaxes;
|
||||
cheddar = tvlDepot.tools.cheddar;
|
||||
naersk = nixpkgs.callPackage naerskSrc {};
|
||||
|
||||
crate2nix = import "${crate2nixSrc}" { pkgs = ch.depot.pkgs; };
|
||||
|
|
4
third_party/tvl/copy.bara.sky
vendored
4
third_party/tvl/copy.bara.sky
vendored
|
@ -9,6 +9,10 @@ core.workflow(
|
|||
fetch = "default",
|
||||
push = "default",
|
||||
),
|
||||
origin_files = glob(["**"], exclude = [
|
||||
"nix/utils/tests/**", # nix/utils/tests/missing makes everything barf
|
||||
"users/**",
|
||||
]),
|
||||
destination_files = glob(["third_party/tvl/**"], exclude = [
|
||||
"third_party/tvl/copy.bara.sky",
|
||||
"third_party/tvl/patches/**",
|
||||
|
|
39
third_party/tvl/nix/buildGo/default.nix
vendored
39
third_party/tvl/nix/buildGo/default.nix
vendored
|
@ -5,6 +5,7 @@
|
|||
# rules_go.
|
||||
|
||||
{ pkgs ? import <nixpkgs> { }
|
||||
, gopkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
|
@ -110,23 +111,43 @@ let
|
|||
|
||||
# Import support libraries needed for protobuf & gRPC support
|
||||
protoLibs = import ./proto.nix {
|
||||
inherit external;
|
||||
inherit gopkgs;
|
||||
};
|
||||
|
||||
# Build a Go library out of the specified protobuf definition.
|
||||
proto = { name, proto, path ? name, goPackage ? name, extraDeps ? [ ] }: (makeOverridable package) {
|
||||
proto = { name, proto ? null, protos ? [ proto ], path ? name, goPackage ? name, withGrpc ? false, extraSrcs ? [], extraDeps ? [] }:
|
||||
let
|
||||
protosDir = runCommand "protos" {} ''
|
||||
mkdir $out
|
||||
${lib.concatMapStrings (p: "cp ${p} $out/${baseNameOf p}\n") protos}
|
||||
'';
|
||||
mname = prefix: lib.concatMapStrings (p: "${prefix}M${baseNameOf p}=${path} ") protos;
|
||||
in (makeOverridable package) {
|
||||
inherit name path;
|
||||
deps = [ protoLibs.goProto.proto.gopkg ] ++ extraDeps;
|
||||
srcs = lib.singleton (runCommand "goproto-${name}.pb.go" { } ''
|
||||
cp ${proto} ${baseNameOf proto}
|
||||
${protobuf}/bin/protoc --plugin=${protoLibs.goProto.protoc-gen-go.gopkg}/bin/protoc-gen-go \
|
||||
--go_out=plugins=grpc,import_path=${baseNameOf path}:. ${baseNameOf proto}
|
||||
mv ./${goPackage}/*.pb.go $out
|
||||
'');
|
||||
srcs = lib.concatMap (proto: lib.singleton (runCommand "goproto-${name}-${baseNameOf proto}.pb.go" {} ''
|
||||
${protobuf}/bin/protoc \
|
||||
-I ${protosDir} \
|
||||
--plugin=${protoLibs.goProto.cmd.protoc-gen-go.gopkg}/bin/protoc-gen-go \
|
||||
--go_out=. \
|
||||
--go_opt=paths=source_relative \
|
||||
${mname "--go_opt="} \
|
||||
${protosDir}/${baseNameOf proto}
|
||||
mv ./*.pb.go $out
|
||||
'') ++ lib.optional withGrpc (runCommand "gogrpcproto-${name}-${baseNameOf proto}.pb.go" {} ''
|
||||
${protobuf}/bin/protoc \
|
||||
-I ${protosDir} \
|
||||
--plugin=${protoLibs.goGrpc.cmd.protoc-gen-go-grpc.gopkg}/bin/protoc-gen-go-grpc \
|
||||
--go-grpc_out=. \
|
||||
--go-grpc_opt=paths=source_relative \
|
||||
${mname "--go-grpc_opt="} \
|
||||
${protosDir}/${baseNameOf proto}
|
||||
mv ./*.pb.go $out 2>/dev/null || echo "package ${goPackage}" >> $out
|
||||
'')) protos ++ extraSrcs;
|
||||
};
|
||||
|
||||
# Build a Go library out of the specified gRPC definition.
|
||||
grpc = args: proto (args // { extraDeps = [ protoLibs.goGrpc.gopkg ]; });
|
||||
grpc = { extraDeps ? [], ... }@args: proto (args // { withGrpc = true; extraDeps = extraDeps ++ [ protoLibs.goGrpc.gopkg ]; });
|
||||
|
||||
in
|
||||
{
|
||||
|
|
81
third_party/tvl/nix/buildGo/proto.nix
vendored
81
third_party/tvl/nix/buildGo/proto.nix
vendored
|
@ -4,84 +4,11 @@
|
|||
# This file provides derivations for the dependencies of a gRPC
|
||||
# service in Go.
|
||||
|
||||
{ external }:
|
||||
{ gopkgs }:
|
||||
|
||||
let
|
||||
inherit (builtins) fetchGit map;
|
||||
in
|
||||
rec {
|
||||
goProto = external {
|
||||
path = "github.com/golang/protobuf";
|
||||
src = fetchGit {
|
||||
url = "https://github.com/golang/protobuf";
|
||||
rev = "ed6926b37a637426117ccab59282c3839528a700";
|
||||
};
|
||||
};
|
||||
|
||||
xnet = external {
|
||||
path = "golang.org/x/net";
|
||||
|
||||
src = fetchGit {
|
||||
url = "https://go.googlesource.com/net";
|
||||
rev = "ffdde105785063a81acd95bdf89ea53f6e0aac2d";
|
||||
};
|
||||
|
||||
deps = [
|
||||
xtext.secure.bidirule
|
||||
xtext.unicode.bidi
|
||||
xtext.unicode.norm
|
||||
];
|
||||
};
|
||||
|
||||
xsys = external {
|
||||
path = "golang.org/x/sys";
|
||||
src = fetchGit {
|
||||
url = "https://go.googlesource.com/sys";
|
||||
rev = "bd437916bb0eb726b873ee8e9b2dcf212d32e2fd";
|
||||
};
|
||||
};
|
||||
|
||||
xtext = external {
|
||||
path = "golang.org/x/text";
|
||||
src = fetchGit {
|
||||
url = "https://go.googlesource.com/text";
|
||||
rev = "cbf43d21aaebfdfeb81d91a5f444d13a3046e686";
|
||||
};
|
||||
};
|
||||
|
||||
genproto = external {
|
||||
path = "google.golang.org/genproto";
|
||||
src = fetchGit {
|
||||
url = "https://github.com/google/go-genproto";
|
||||
# necessary because https://github.com/NixOS/nix/issues/1923
|
||||
ref = "main";
|
||||
rev = "83cc0476cb11ea0da33dacd4c6354ab192de6fe6";
|
||||
};
|
||||
|
||||
deps = with goProto; [
|
||||
proto
|
||||
ptypes.any
|
||||
];
|
||||
};
|
||||
|
||||
goGrpc = external {
|
||||
path = "google.golang.org/grpc";
|
||||
deps = ([
|
||||
xnet.trace
|
||||
xnet.http2
|
||||
xsys.unix
|
||||
xnet.http2.hpack
|
||||
genproto.googleapis.rpc.status
|
||||
] ++ (with goProto; [
|
||||
proto
|
||||
ptypes
|
||||
ptypes.duration
|
||||
ptypes.timestamp
|
||||
]));
|
||||
|
||||
src = fetchGit {
|
||||
url = "https://github.com/grpc/grpc-go";
|
||||
rev = "d8e3da36ac481ef00e510ca119f6b68177713689";
|
||||
};
|
||||
};
|
||||
in rec {
|
||||
goProto = gopkgs."google.golang.org".protobuf;
|
||||
goGrpc = gopkgs."google.golang.org".grpc;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue