about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-03-09T10·32+0100
committerVincent Ambo <github@tazj.in>2018-03-09T12·35+0100
commit4b1d44f71bf243a86b90d047ef65d5b418b4f5bd (patch)
treeaf1995b9f32f479012aec0dfdfaadeb1c3f58822
parent9286e70da371e2dda00ca0d280fcbbb2b2720e80 (diff)
refactor(build): Add Nix derivation & configure Travis to build it
Adds a Nix-derivation for building kontemplate with dependencies
pinned in Nix.
-rw-r--r--.travis.yml5
-rw-r--r--default.nix33
-rw-r--r--deps.nix120
3 files changed, 154 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index 382ca50619..b49a7b383f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,2 @@
 ---
-language: go
-before_script:
-  - if [[ -n "$(go fmt ./...)" ]]; then echo 'Run go fmt!' && exit 1; fi
-  - go vet ./...
+language: nix
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000000..f61d83153d
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,33 @@
+# Copyright (C) 2016-2018  Vincent Ambo <mail@tazj.in>
+#
+# This file is part of Kontemplate.
+#
+# Kontemplate is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is the Nix derivation used to install Kontemplate on
+# Nix-based systems.
+
+{ pkgs ? import <nixpkgs> {} }:
+
+with pkgs; buildGoPackage rec {
+  name = "kontemplate-${version}";
+  version = "master";
+  src = ./.;
+  goPackagePath = "github.com/tazjin/kontemplate";
+  goDeps = ./deps.nix;
+
+  # Enable checks and configure check-phase to include vet:
+  doCheck = true;
+  preCheck = ''
+    getGoDirs "" | parallel -j $NIX_BUILD_CORES buildGoDir vet
+  '';
+
+  meta = with lib; {
+    description = "A resource templating helper for Kubernetes";
+    homepage = "http://kontemplate.works/";
+    license = licenses.gpl3;
+  };
+}
diff --git a/deps.nix b/deps.nix
new file mode 100644
index 0000000000..811654f343
--- /dev/null
+++ b/deps.nix
@@ -0,0 +1,120 @@
+# This file was generated by https://github.com/kamilchm/go2nix v1.2.1
+[
+  {
+    goPackagePath = "github.com/Masterminds/semver";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/Masterminds/semver";
+      rev    = "517734cc7d6470c0d07130e40fd40bdeb9bcd3fd";
+      sha256 = "1625b5sxpmlz60jw67j1ljfcc09d4lhxg3z6gc4am8s2rrdgwij6";
+    };
+  }
+  {
+    goPackagePath = "github.com/Masterminds/sprig";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/Masterminds/sprig";
+      rev    = "e039e20e500c2c025d9145be375e27cf42a94174";
+      sha256 = "1yhpyzq6ghwl0242phjpbc9358fcw63pxrcxsyv9n4dm0w15va3m";
+    };
+  }
+  {
+    goPackagePath = "github.com/alecthomas/template";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/alecthomas/template";
+      rev    = "a0175ee3bccc567396460bf5acd36800cb10c49c";
+      sha256 = "0qjgvvh26vk1cyfq9fadyhfgdj36f1iapbmr5xp6zqipldz8ffxj";
+    };
+  }
+  {
+    goPackagePath = "github.com/alecthomas/units";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/alecthomas/units";
+      rev    = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a";
+      sha256 = "1j65b91qb9sbrml9cpabfrcf07wmgzzghrl7809hjjhrmbzri5bl";
+    };
+  }
+  {
+    goPackagePath = "github.com/aokoli/goutils";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/aokoli/goutils";
+      rev    = "3391d3790d23d03408670993e957e8f408993c34";
+      sha256 = "1yj4yjfwylica31sgj69ygb04p9xxi22kgfxd0j5f58zr8vwww2n";
+    };
+  }
+  {
+    goPackagePath = "github.com/ghodss/yaml";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/ghodss/yaml";
+      rev    = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7";
+      sha256 = "0skwmimpy7hlh7pva2slpcplnm912rp3igs98xnqmn859kwa5v8g";
+    };
+  }
+  {
+    goPackagePath = "github.com/huandu/xstrings";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/huandu/xstrings";
+      rev    = "3959339b333561bf62a38b424fd41517c2c90f40";
+      sha256 = "0f1jyd80grpr88gwhljx2x0xgsyzw07807n4z4axxxlybh5f0nh1";
+    };
+  }
+  {
+    goPackagePath = "github.com/imdario/mergo";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/imdario/mergo";
+      rev    = "d806ba8c21777d504a2090a2ca4913c750dd3a33";
+      sha256 = "12n3lfbfxvnag916c6dpxl48j29s482zwsqjc6wk4vb68qbz2nl3";
+    };
+  }
+  {
+    goPackagePath = "github.com/polydawn/meep";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/polydawn/meep";
+      rev    = "eaf1db2168fe380b4da17a35f0adddb5ae15a651";
+      sha256 = "12n134fb2imnj67xkbznzm0gqkg36hdxwr960y91qb5s2q2krxir";
+    };
+  }
+  {
+    goPackagePath = "github.com/satori/go.uuid";
+    fetch = {
+      type   = "git";
+      url    = "https://github.com/satori/go.uuid";
+      rev    = "5bf94b69c6b68ee1b541973bb8e1144db23a194b";
+      sha256 = "0l782l4srv36pj8pfgn61996d0vjifld4a569rbjwq5h14pd0c07";
+    };
+  }
+  {
+    goPackagePath = "golang.org/x/crypto";
+    fetch = {
+      type   = "git";
+      url    = "https://go.googlesource.com/crypto";
+      rev    = "ab89591268e0c8b748cbe4047b00197516011af5";
+      sha256 = "1cbg8wlv1hmdps9ksa4kym5zy0mb2yjykw4ns7yqv7nmz4s5xajr";
+    };
+  }
+  {
+    goPackagePath = "gopkg.in/alecthomas/kingpin.v2";
+    fetch = {
+      type   = "git";
+      url    = "https://gopkg.in/alecthomas/kingpin.v2";
+      rev    = "1087e65c9441605df944fb12c33f0fe7072d18ca";
+      sha256 = "18llqzkdqf62qbqcv2fd3j0igl6cwwn4dissf5skkvxrcxjcmmj0";
+    };
+  }
+  {
+    goPackagePath = "gopkg.in/yaml.v2";
+    fetch = {
+      type   = "git";
+      url    = "https://gopkg.in/yaml.v2";
+      rev    = "eb3733d160e74a9c7e442f435eb3bea458e1d19f";
+      sha256 = "1srhvcaa9db3a6xj29mkjr5kg33y71pclrlx4vcwz5m1lgb5c7q6";
+    };
+  }
+]