2022-05-26 09:11:34 +00:00
|
|
|
{ buildGoPackage
|
2022-05-19 15:50:41 +00:00
|
|
|
# object with source attributes
|
|
|
|
, meta, source}:
|
|
|
|
|
2022-05-26 09:11:34 +00:00
|
|
|
buildGoPackage {
|
2022-05-19 15:50:41 +00:00
|
|
|
pname = source.repo;
|
|
|
|
version = "${source.cleanVersion}-${source.shortRev}";
|
|
|
|
|
|
|
|
inherit meta;
|
|
|
|
inherit (source) src goPackagePath;
|
|
|
|
|
|
|
|
phases = ["unpackPhase" "configurePhase" "buildPhase"];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
pushd go/src/$goPackagePath
|
|
|
|
go run cmd/library/*.go > $NIX_BUILD_TOP/main.go
|
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Build the Go library
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
2022-05-26 09:11:34 +00:00
|
|
|
go build -buildmode=c-archive -o $out/libstatus.a $NIX_BUILD_TOP/main.go
|
2022-05-19 15:50:41 +00:00
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
}
|