git.iko.soy/rowtype-yoga/purescript-protobuf
on demo-nix-github help sign in
64 lines 2.0 kB history raw
1{ pkgs ? import <nixpkgs> { } }:
3# https://nixos.wiki/wiki/Packaging/Quirks_and_Caveats
4# https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/protobuf/generic-v3.nix
6let
7 # version = "v3.13.0";
8 # sha256 = "1nqsvi2yfr93kiwlinz8z7c68ilg1j75b2vcpzxzvripxx5h6xhd";
9 version = "v3.9.2";
10 sha256 = "080zxa9w1pxp5y05aiwc0c8mlqkkh98wmid4l7m99cliphsd4qnn";
12 protobufRepo = pkgs.fetchFromGitHub {
13 owner = "protocolbuffers";
14 repo = "protobuf";
15 rev = version;
16 inherit sha256;
17 };
19 # # This is pretty much what's in nixpkgs as "protobuf", just `protoc`.
20 # protoc = pkgs.stdenv.mkDerivation {
21 # name = "protoc-${version}";
22 # buildInputs = [ pkgs.autoreconfHook ];
23 # src = protobufRepo;
24 # };
26 # Builds `protoc`, plus the conformance test runners, and also copies
27 # in the .proto files for the conformance test protocol,
28 # especially `./src/google/protobuf/test_messages_proto3.proto`
29 #
30 # https://github.com/protocolbuffers/protobuf/tree/master/conformance
31 #
32 # See the Travis test runner script
33 # https://github.com/protocolbuffers/protobuf/blob/master/tests.sh
34 #
35 # https://laptrinhx.com/an-elixir-library-for-protocol-buffers-2920413944/#conformance
36 protobuf = pkgs.stdenv.mkDerivation {
37 name = "conformance-${version}";
38 nativeBuildInputs = with pkgs; [ autogen automake autoconf libtool rsync ];
39 src = protobufRepo;
40 configurePhase = ''
41 ./autogen.sh
42 ./configure --prefix=$out
43 '';
44 buildPhase = ''
45 make --jobs=$NIX_BUILD_CORES
46 cd conformance
47 make
48 cd ..
49 '';
50 installPhase = ''
51 mkdir -p $out
52 make install
53 cd conformance
54 make install
55 cd ..
56 cp ./test-driver $out/bin/test-driver
57 rsync -am --include='*.proto' --include='*/' --exclude='*' src $out/
58 mkdir -p $out/conformance
59 cp ./conformance/conformance.proto $out/conformance/
60 '';
61 LC_ALL = "C.UTF-8";
62 };
64in protobuf