2024-07-01 15:47:52 +00:00
|
|
|
{ lib, stdenv, nanopb }:
|
2020-06-18 07:06:33 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "nanopb-test-simple-proto3";
|
|
|
|
meta.timeout = 60;
|
2024-06-20 14:57:18 +00:00
|
|
|
src = lib.fileset.toSource {
|
|
|
|
root = ./.;
|
|
|
|
fileset = lib.fileset.unions [ ./simple.proto ];
|
|
|
|
};
|
2024-07-01 15:47:52 +00:00
|
|
|
|
|
|
|
buildInputs = [ nanopb ];
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
# protoc requires any .proto file to be compiled to reside within it's
|
|
|
|
# proto_path. By default the current directory is automatically added to the
|
|
|
|
# proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
|
|
|
|
# not work because they end up in the store at different locations.
|
2021-07-21 07:28:18 +00:00
|
|
|
dontInstall = true;
|
2020-06-18 07:06:33 +00:00
|
|
|
buildPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
|
2024-07-01 15:47:52 +00:00
|
|
|
protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
|
2020-06-18 07:06:33 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkPhase = ''
|
|
|
|
grep -q SimpleMessage $out/simple.pb.c || (echo "ERROR: SimpleMessage not found in $out/simple.pb.c"; exit 1)
|
|
|
|
grep -q SimpleMessage $out/simple.pb.h || (echo "ERROR: SimpleMessage not found in $out/simple.pb.h"; exit 1)
|
|
|
|
'';
|
|
|
|
}
|