fix: nix build environment fixes

- flake.nix: add capnpc source override (ghfast.top proxy)
- flake.nix: add GOROOT to devShell for Go version consistency
- tools/go_build: support file:// GOPROXY for sandbox builds
- bcctool: add .gitignore for gomodcache/
- bcctool: go.mod updated by go mod download

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-07-24 07:03:18 +00:00
parent cae4ef0cc7
commit 98066db68d
4 changed files with 18 additions and 3 deletions

View file

@ -0,0 +1 @@
gomodcache/

View file

@ -4,18 +4,18 @@ go 1.22.2
require (
github.com/baidubce/bce-sdk-go v0.9.233
github.com/google/uuid v1.6.0
github.com/xeipuuv/gojsonschema v1.2.0
)
require (
github.com/google/uuid v1.6.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
)
require (
go.uber.org/multierr v1.10.0 // indirect
go.uber.org/zap v1.27.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
go.uber.org/zap v1.27.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v2 v2.4.0
)

View file

@ -22,6 +22,14 @@
mypkgs = xbuild.packages.${system} // extralib.packages.${system} // librtti.packages.${system};
overlays = [
(final: prev: mypkgs // prev)
(final: prev: {
capnpc = prev.capnpc.overrideAttrs (oldAttrs: {
src = final.fetchurl {
url = "https://ghfast.top/https://github.com/shen390s/c-capnproto/archive/e45ff682c4756ac5067cbac6d0f282a8ea5f0155.tar.gz";
hash = "sha256-zsiX6unPF45eISP6sqbQImrivJuSE0BF4bTP/db+lQY=";
};
});
})
];
pkgs = import nixpkgs { inherit overlays system;};
xpkgs = import ./nixSupport/default.nix {
@ -58,6 +66,7 @@
defaultPackage = xpkgs.xcecore_debug;
devShells.default = pkgs.mkShell {
nativeBuildInputs = xpkgs.xcecore.nativeBuildInputs;
GOROOT = "${pkgs.go}/share/go";
};
devShell = self.devShells.${system}.default;

View file

@ -99,4 +99,9 @@ done
export GOPROXY=https://goproxy.cn
# Use pre-downloaded Go module cache if available (avoids network inside sandbox)
if [ -d "$_sdir/gomodcache/pkg/mod/cache/download" ]; then
export GOPROXY="file://${_sdir}/gomodcache/pkg/mod/cache/download,off"
fi
(cd $_sdir; go build -gcflags "all=-N -l" -o "$_dfile" "$_sfile")