Commit graph

11 commits

Author SHA1 Message Date
Vincent Ambo
e60dfabc21 feat(buildGo): Expose Go import path for packages 2019-12-13 00:39:53 +00:00
Vincent Ambo
57f37743c2 fix(buildGo): Ensure 'proto' libraries are overridable 2019-12-13 00:39:53 +00:00
Vincent Ambo
c40e8a4061 feat(buildGo): Add new traversing external' implementation
Adds an alternative implementation of a builder for external packages
which traverses packages and builds up an attribute set tree out of
their structure.

Currently this is not functional because there is no useable method of
specifying dependencies within that package set.
2019-12-13 00:39:53 +00:00
Vincent Ambo
6a526620e2 feat(buildGo): Add 'overrideGo' argument overriding function
This makes it possible to override arguments to the Go builders
downstream in the style of `overrideAttrs` from standard nixpkgs
derivations.

For example, given a Nix value `foo` that builds a binary called `foo`
the name of this binary could be changed and a new dependency on
`somelib` added like so:

    foo.overrideGo(old: {
      name = "bar";
      deps = old.deps ++ [ somelib ];
    })
2019-12-09 01:07:21 +00:00
Vincent Ambo
9280cf9715 feat(buildGo): Add support for gRPC packages
Introduces buildGo.grpc which is like buildGo.proto, but adds
dependencies on the gRPC libraries.
2019-11-26 12:28:10 +00:00
Vincent Ambo
d3e8774a8e feat(proto): Add protobuf & gRPC dependencies via external
Moves the Protobuf & gRPC dependencies to a separate file which uses
buildGo.external to build the dependencies.

The versions are pinned at master of 2019-11-26.
2019-11-26 12:28:10 +00:00
Vincent Ambo
8b6b08b814 feat(buildGo): Add 'srcOnly' and 'targets' parameters for external
Adds two new parameters to buildGo.external:

* `srcOnly` toggles whether the created derivation should contain only
  the source code, or the built package.

  This is useful in situations where some sub-packages of a larger
  package are needed and the build should be deferred to the package
  depending on them.

  It defaults to false, meaning that external packages are built by
  default.

* `targets` controls which "sub-packages" of the target package are
  built. It defaults to building all sub-packages.
2019-11-26 12:21:58 +00:00
Vincent Ambo
7d26550c11 feat(buildGo): Add support for building "external" Go libraries
Adds a buildGo.external function that can build packages following the
default go-tool package layout. Dependencies work the same way as they
do for other buildGo-packages, but instead of being passed straight to
the compiler a fake GOPATH is assembled using a symlink forest.

External currently supports very few direct configuration options and
was primarily created to build the protobuf packages, but it is also
useful for including external dependencies in buildGo-native projects.

The previous complex build logic for the protobuf package has been
replaced with a call to `external`.
2019-11-25 16:45:21 +00:00
Vincent Ambo
0fd7466922 feat(buildGo): Add support for x_defs option in buildGo.program
This lets users define an attribute set with link time options.
2019-11-24 20:41:01 +00:00
Vincent Ambo
d441e035aa feat: Add support for Protobuf-generated libraries
Adds a 'buildGo.proto' function which takes a single .proto file as
its source and generates a corresponding Go library which can then be
imported.

'proto' takes these arguments (Yants-style type definition):

struct "protoArgs" {
  # required:
  name = string;
  proto = path;

  # optional:
  extraDeps = list goLib; # defaults to [ ]
  protocFlags = option string;
}

Note that proto libraries will automatically have dependencies for the
required protobuf Go libraries added to them.

gRPC is not (yet) supported.
2019-11-24 20:17:17 +00:00
Vincent Ambo
24225580e8 feat: Check in buildGo with program & package builders 2019-11-23 15:25:11 +00:00