diff --git a/pkgs/applications/networking/syncthing/default.nix b/pkgs/applications/networking/syncthing/default.nix index 3b171070a573..d221324b205b 100644 --- a/pkgs/applications/networking/syncthing/default.nix +++ b/pkgs/applications/networking/syncthing/default.nix @@ -1,4 +1,4 @@ -{ buildGoModule, stdenv, lib, procps, fetchFromGitHub, nixosTests }: +{ pkgsBuildBuild, go, buildGoModule, stdenv, lib, procps, fetchFromGitHub, nixosTests }: let common = { stname, target, postInstall ? "" }: @@ -22,7 +22,12 @@ let buildPhase = '' runHook preBuild - go run build.go -no-upgrade -version v${version} build ${target} + ( + export GOOS="${pkgsBuildBuild.go.GOOS}" GOARCH="${pkgsBuildBuild.go.GOARCH}" CC=$CC_FOR_BUILD + go build build.go + go generate github.com/syncthing/syncthing/lib/api/auto github.com/syncthing/syncthing/cmd/strelaypoolsrv/auto + ) + ./build -goos ${go.GOOS} -goarch ${go.GOARCH} -no-upgrade -version v${version} build ${target} runHook postBuild '';