summary refs log tree commit diff
path: root/pkgs/os-specific/linux/chromium-os/vm_protos/default.nix
blob: e87d0c57e789a1337b582e51e3925ac95bac933b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ common-mk, lib, go-protobuf, grpc, openssl, protobuf }:

common-mk {
  pname = "vm_protos";
  platformSubdir = "vm_tools/proto";

  nativeBuildInputs = [ go-protobuf ];
  buildInputs = [ grpc openssl protobuf ];

  NIX_CFLAGS_COMPILE = [
    "-Wno-error=array-bounds"
    "-Wno-error=deprecated-declarations"
  ];

  postPatch = ''
    substituteInPlace common-mk/proto_library.gni \
        --replace /usr/bin/grpc_cpp_plugin ${grpc}/bin/grpc_cpp_plugin
  '';

  installPhase = ''
    mkdir -p $out/lib/pkgconfig
    install -m 644 ../../vm_tools/proto/vm_protos.pc $out/lib/pkgconfig

    headerPath=include/vm_protos/proto_bindings
    mkdir -p $out/$headerPath
    install -m 644 gen/$headerPath/*.h $out/$headerPath

    install -m 644 *.a $out/lib
  '';

  meta = with lib; {
    description = "Protobuf definitions for Chromium OS system VMs";
    maintainers = with maintainers; [ qyliss ];
    platform = platforms.all;
  };
}