about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2')
-rw-r--r--nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/default.nix24
-rw-r--r--nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/simple.proto5
2 files changed, 29 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/default.nix b/nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/default.nix
new file mode 100644
index 000000000000..a915e7785370
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, protobuf, nanopb }:
+
+stdenv.mkDerivation {
+  name = "nanopb-test-simple-proto2";
+  meta.timeout = 60;
+  src = ./.;
+
+  # 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.
+  installPhase = ":";
+  buildPhase = ''
+    mkdir $out
+
+    ${protobuf}/bin/protoc --plugin=protoc-gen-nanopb=${nanopb}/bin/protoc-gen-nanopb --nanopb_out=$out simple.proto
+  '';
+
+  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)
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/simple.proto b/nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/simple.proto
new file mode 100644
index 000000000000..b02936b1ae26
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/nanopb/test-simple-proto2/simple.proto
@@ -0,0 +1,5 @@
+syntax = "proto2";
+
+message SimpleMessage {
+  required int32 lucky_number = 1;
+}