···1+{ stdenv, protobuf, nanopb }:
2+3+stdenv.mkDerivation {
4+ name = "nanopb-test-message-with-annotations";
5+ meta.timeout = 60;
6+ src = ./.;
7+8+ # protoc requires any .proto file to be compiled to reside within it's
9+ # proto_path. By default the current directory is automatically added to the
10+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
11+ # not work because they end up in the store at different locations.
12+ installPhase = ":";
13+ buildPhase = ''
14+ mkdir $out
15+16+ ${protobuf}/bin/protoc --proto_path=. --proto_path=${nanopb}/share/nanopb/generator/proto --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out withannotations.proto
17+ '';
18+19+ docheck = true;
20+ checkphase = ''
21+ grep -q WithAnnotations $out/withannotations.pb.c || (echo "error: WithAnnotations not found in $out/withannotations.pb.c"; exit 1)
22+ grep -q WithAnnotations $out/withannotations.pb.h || (echo "error: WithAnnotations not found in $out/withannotations.pb.h"; exit 1)
23+ grep -q "pb_byte_t uuid\[16\]" $out/withannotations.pb.h || (echo "error: uuid is not of type pb_byte_t and of size 16 in $out/withannotations.pb.h"; exit 1)
24+ grep -q "FIXED_LENGTH_BYTES, uuid" $out/withannotations.pb.h || (echo "error: uuid is not of fixed lenght bytes in $out/withannotations.pb.h"; exit 1)
25+ grep -q "#define WithAnnotations_size" $out/withannotations.pb.h || (echo "error: the size of WithAnnotations is not known in $out/withannotations.pb.h"; exit 1)
26+ '';
27+}
···1+{ stdenv, protobuf, nanopb }:
2+3+stdenv.mkDerivation {
4+ name = "nanopb-test-message-with-options";
5+ meta.timeout = 60;
6+ src = ./.;
7+8+ # protoc requires any .proto file to be compiled to reside within it's
9+ # proto_path. By default the current directory is automatically added to the
10+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
11+ # not work because they end up in the store at different locations.
12+ installPhase = ":";
13+ buildPhase = ''
14+ mkdir $out
15+16+ ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out withoptions.proto
17+ '';
18+19+ docheck = true;
20+ checkphase = ''
21+ grep -q WithOptions $out/withoptions.pb.c || (echo "error: WithOptions not found in $out/withoptions.pb.c"; exit 1)
22+ grep -q WithOptions $out/withoptions.pb.h || (echo "error: WithOptions not found in $out/withoptions.pb.h"; exit 1)
23+ grep -q "pb_byte_t uuid\[16\]" $out/withoptions.pb.h || (echo "error: uuid is not of type pb_byte_t and of size 16 in $out/withoptions.pb.h"; exit 1)
24+ grep -q "FIXED_LENGTH_BYTES, uuid" $out/withoptions.pb.h || (echo "error: uuid is not of fixed lenght bytes in $out/withoptions.pb.h"; exit 1)
25+ grep -q "#define WithOptions_size" $out/withoptions.pb.h || (echo "error: the size of WithOptions is not known in $out/withoptions.pb.h"; exit 1)
26+ '';
27+}
···1+{ stdenv, protobuf, nanopb }:
2+3+stdenv.mkDerivation {
4+ name = "nanopb-test-simple-proto2";
5+ meta.timeout = 60;
6+ src = ./.;
7+8+ # protoc requires any .proto file to be compiled to reside within it's
9+ # proto_path. By default the current directory is automatically added to the
10+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
11+ # not work because they end up in the store at different locations.
12+ installPhase = ":";
13+ buildPhase = ''
14+ mkdir $out
15+16+ ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
17+ '';
18+19+ doCheck = true;
20+ checkPhase = ''
21+ grep -q SimpleMessage $out/simple.pb.c || (echo "ERROR: SimpleMessage not found in $out/simple.pb.c"; exit 1)
22+ grep -q SimpleMessage $out/simple.pb.h || (echo "ERROR: SimpleMessage not found in $out/simple.pb.h"; exit 1)
23+ '';
24+}
···1+{ stdenv, protobuf, nanopb }:
2+3+stdenv.mkDerivation {
4+ name = "nanopb-test-simple-proto3";
5+ meta.timeout = 60;
6+ src = ./.;
7+8+ # protoc requires any .proto file to be compiled to reside within it's
9+ # proto_path. By default the current directory is automatically added to the
10+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
11+ # not work because they end up in the store at different locations.
12+ installPhase = ":";
13+ buildPhase = ''
14+ mkdir $out
15+16+ ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
17+ '';
18+19+ doCheck = true;
20+ checkPhase = ''
21+ grep -q SimpleMessage $out/simple.pb.c || (echo "ERROR: SimpleMessage not found in $out/simple.pb.c"; exit 1)
22+ grep -q SimpleMessage $out/simple.pb.h || (echo "ERROR: SimpleMessage not found in $out/simple.pb.h"; exit 1)
23+ '';
24+}