about summary refs log tree commit diff
path: root/tools/gotest/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-11-27T15·47+0000
committerGitHub <noreply@github.com>2019-11-27T15·47+0000
commit9d6792609f0de0c3c9209f300756024f8c3524da (patch)
tree5074383f42d4ec838a96834729ee6bd7deb90058 /tools/gotest/default.nix
parentae53bf30c3306eeb56731e6e7aefc2bab278c6e0 (diff)
parent0bd085f5d6602ab75689156b92af04e7f83d69fd (diff)
Merge pull request #10 from tazjin/feat/buildGo-dot-nix r/96
Introduce Bazel-style Nix build system for Go
Diffstat (limited to 'tools/gotest/default.nix')
-rw-r--r--tools/gotest/default.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/gotest/default.nix b/tools/gotest/default.nix
new file mode 100644
index 000000000000..168d15748e1f
--- /dev/null
+++ b/tools/gotest/default.nix
@@ -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 ];
+} // { meta.enableCI = true; }