feat(tools): Add 'gotest' program to demonstrate pkgs.buildGo
This is a tiny program that does nothing but exists to demonstrate pkgs.buildGo by building a program that depends on a local library as well as a protobuf definition.
This commit is contained in:
parent
9ea0363e6f
commit
1619f58d78
4 changed files with 63 additions and 0 deletions
27
tools/gotest/default.nix
Normal file
27
tools/gotest/default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# This file demonstrates how to make use of pkgs.buildGo.
|
||||
#
|
||||
# It introduces libraries and protobuf support, however gRPC support
|
||||
# is not yet included.
|
||||
#
|
||||
# From the root of this repository this example can be built with
|
||||
# `nix-build -A tools.gotest`
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
inherit (pkgs) buildGo;
|
||||
|
||||
somelib = buildGo.package {
|
||||
name = "somelib";
|
||||
srcs = [ ./lib.go ];
|
||||
};
|
||||
|
||||
someproto = buildGo.proto {
|
||||
name = "someproto";
|
||||
proto = ./test.proto;
|
||||
};
|
||||
|
||||
in buildGo.program {
|
||||
name = "gotest";
|
||||
srcs = [ ./main.go ];
|
||||
deps = [ somelib someproto ];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue