···11+{ stdenv, protobuf, nanopb }:
22+33+stdenv.mkDerivation {
44+ name = "nanopb-test-message-with-annotations";
55+ meta.timeout = 60;
66+ src = ./.;
77+88+ # protoc requires any .proto file to be compiled to reside within it's
99+ # proto_path. By default the current directory is automatically added to the
1010+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
1111+ # not work because they end up in the store at different locations.
1212+ installPhase = ":";
1313+ buildPhase = ''
1414+ mkdir $out
1515+1616+ ${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
1717+ '';
1818+1919+ docheck = true;
2020+ checkphase = ''
2121+ grep -q WithAnnotations $out/withannotations.pb.c || (echo "error: WithAnnotations not found in $out/withannotations.pb.c"; exit 1)
2222+ grep -q WithAnnotations $out/withannotations.pb.h || (echo "error: WithAnnotations not found in $out/withannotations.pb.h"; exit 1)
2323+ 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)
2424+ 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)
2525+ 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)
2626+ '';
2727+}
···11+{ stdenv, protobuf, nanopb }:
22+33+stdenv.mkDerivation {
44+ name = "nanopb-test-message-with-options";
55+ meta.timeout = 60;
66+ src = ./.;
77+88+ # protoc requires any .proto file to be compiled to reside within it's
99+ # proto_path. By default the current directory is automatically added to the
1010+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
1111+ # not work because they end up in the store at different locations.
1212+ installPhase = ":";
1313+ buildPhase = ''
1414+ mkdir $out
1515+1616+ ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out withoptions.proto
1717+ '';
1818+1919+ docheck = true;
2020+ checkphase = ''
2121+ grep -q WithOptions $out/withoptions.pb.c || (echo "error: WithOptions not found in $out/withoptions.pb.c"; exit 1)
2222+ grep -q WithOptions $out/withoptions.pb.h || (echo "error: WithOptions not found in $out/withoptions.pb.h"; exit 1)
2323+ 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)
2424+ 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)
2525+ 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)
2626+ '';
2727+}
···11+{ stdenv, protobuf, nanopb }:
22+33+stdenv.mkDerivation {
44+ name = "nanopb-test-simple-proto2";
55+ meta.timeout = 60;
66+ src = ./.;
77+88+ # protoc requires any .proto file to be compiled to reside within it's
99+ # proto_path. By default the current directory is automatically added to the
1010+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
1111+ # not work because they end up in the store at different locations.
1212+ installPhase = ":";
1313+ buildPhase = ''
1414+ mkdir $out
1515+1616+ ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
1717+ '';
1818+1919+ doCheck = true;
2020+ checkPhase = ''
2121+ grep -q SimpleMessage $out/simple.pb.c || (echo "ERROR: SimpleMessage not found in $out/simple.pb.c"; exit 1)
2222+ grep -q SimpleMessage $out/simple.pb.h || (echo "ERROR: SimpleMessage not found in $out/simple.pb.h"; exit 1)
2323+ '';
2424+}
···11+{ stdenv, protobuf, nanopb }:
22+33+stdenv.mkDerivation {
44+ name = "nanopb-test-simple-proto3";
55+ meta.timeout = 60;
66+ src = ./.;
77+88+ # protoc requires any .proto file to be compiled to reside within it's
99+ # proto_path. By default the current directory is automatically added to the
1010+ # proto_path. I tried using --proto_path ${./.} ${./simple.proto} and it did
1111+ # not work because they end up in the store at different locations.
1212+ installPhase = ":";
1313+ buildPhase = ''
1414+ mkdir $out
1515+1616+ ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
1717+ '';
1818+1919+ doCheck = true;
2020+ checkPhase = ''
2121+ grep -q SimpleMessage $out/simple.pb.c || (echo "ERROR: SimpleMessage not found in $out/simple.pb.c"; exit 1)
2222+ grep -q SimpleMessage $out/simple.pb.h || (echo "ERROR: SimpleMessage not found in $out/simple.pb.h"; exit 1)
2323+ '';
2424+}