tools/: add nixops
This now means we require Nix to be installed globally. This shouldn't
be the case in the long run, but will be until
https://github.com/tweag/rules_nixpkgs/issues/75 gets fixed or we maybe
move from rules_nixpkgs to nix-bundle or something similar.
diff --git a/README b/README
index 641cd51..902b12c 100644
--- a/README
+++ b/README
@@ -3,6 +3,8 @@
This is a monorepo. You'll need bash and Bazel 0.20.0+ to use it.
+You'll also need Nix installed globally in your system until [rules_nixpkgs/75](https://github.com/tweag/rules_nixpkgs/issues/75) is resolved. Or run on NixOS.
+
Getting started
---------------
diff --git a/WORKSPACE b/WORKSPACE
index 5ed4df0..c6bc0e1 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,6 +1,27 @@
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+# Nix rules
+http_archive(
+ name = "io_tweag_rules_nixpkgs",
+ strip_prefix = "rules_nixpkgs-364adc70f32c2b3982995fce06b334f4d159070e",
+ urls = ["https://github.com/tweag/rules_nixpkgs/archive/364adc70f32c2b3982995fce06b334f4d159070e.tar.gz"],
+)
+
+# Nix packages
+
+load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_git_repository", "nixpkgs_package")
+nixpkgs_git_repository(
+ name = "nixpkgs",
+ revision = "2f1f9a9fe8a3c22f0677733523eaf6bd33995d50",
+)
+
+nixpkgs_package(
+ name = "nixops",
+ attribute_path = "nixops",
+ repositories = { "nixpkgs": "@nixpkgs" },
+)
+
# Python rules
git_repository(
name = "io_bazel_rules_python",
diff --git a/tools/BUILD b/tools/BUILD
index d80ad4d..80678ca 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -55,3 +55,9 @@
src = "@com_github_cloudflare_cfssl//cmd/cfssl:cfssl",
visibility = ["//visibility:public"],
)
+
+copy_go_binary(
+ name = "nixops",
+ src = "@nixops//:bin",
+ visibility = ["//visibility:public"],
+)
diff --git a/tools/install.sh b/tools/install.sh
index 5d611e6..4485f47 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -9,4 +9,5 @@
bazel build \
//tools:kubectl //tools:kubecfg //tools:secretstore \
- //tools:pass //tools:calicoctl.bin //tools:cfssl
+ //tools:pass //tools:calicoctl.bin //tools:cfssl \
+ //tools:nixops