From fc88548b5d792c3ba4ac0cd2a127cdae52db0420 Mon Sep 17 00:00:00 2001 From: Kamil Chmielewski Date: Sun, 5 Jun 2016 16:41:51 +0200 Subject: [PATCH] go2nix: extracted from goPackages --- pkgs/development/go-modules/libs.json | 36 +++++++++++++++++++++++ pkgs/development/tools/go2nix/default.nix | 32 ++++++++++++++++++++ pkgs/development/tools/go2nix/deps.json | 11 +++++++ pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/go-packages.nix | 19 ------------ 5 files changed, 80 insertions(+), 20 deletions(-) create mode 100644 pkgs/development/tools/go2nix/default.nix create mode 100644 pkgs/development/tools/go2nix/deps.json diff --git a/pkgs/development/go-modules/libs.json b/pkgs/development/go-modules/libs.json index 42a52185a1ff..b83ed703f5f8 100644 --- a/pkgs/development/go-modules/libs.json +++ b/pkgs/development/go-modules/libs.json @@ -1258,5 +1258,41 @@ "rev": "ea925a0a47d225b2ca7f9932b01d2ed4f3ec74f6", "sha256": "15wqjpkfzsxnaxbz6y4r91hw6812g3sc4ipagxw1bya9klbnkdc9" } + }, + { + "goPackagePath": "github.com/alecthomas/template", + "fetch": { + "type": "git", + "url": "https://github.com/alecthomas/template", + "rev": "14fd436dd20c3cc65242a9f396b61bfc8a3926fc", + "sha256": "19rzvvcgvr1z2wz9xpqsmlm8syizbpxjp5zbzgakvrqlajpbjvx2" + } + }, + { + "goPackagePath": "github.com/alecthomas/units", + "fetch": { + "type": "git", + "url": "https://github.com/alecthomas/units", + "rev": "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a", + "sha256": "1j65b91qb9sbrml9cpabfrcf07wmgzzghrl7809hjjhrmbzri5bl" + } + }, + { + "goPackagePath": "gopkg.in/alecthomas/kingpin.v2", + "fetch": { + "type": "git", + "url": "https://gopkg.in/alecthomas/kingpin.v2", + "rev": "21551c2a6259a8145110ca80a36e25c9d7624032", + "sha256": "1zhpqc4qxsw9lc1b4dwk5r42k9r702ihzrabs3mnsphvm9jx4l59" + } + }, + { + "goPackagePath": "github.com/Masterminds/vcs", + "fetch": { + "type": "git", + "url": "https://github.com/Masterminds/vcs", + "rev": "9c0db6583837118d5df7c2ae38ab1c194e434b35", + "sha256": "0590ww2av4407y7zy3bcmnr8i74fv00k9zzcxcpjxivl6qszna0d" + } } ] diff --git a/pkgs/development/tools/go2nix/default.nix b/pkgs/development/tools/go2nix/default.nix new file mode 100644 index 000000000000..bb0000d9e736 --- /dev/null +++ b/pkgs/development/tools/go2nix/default.nix @@ -0,0 +1,32 @@ +# This file was generated by go2nix. +{ stdenv, lib, goPackages, go-bindata, goimports, nix-prefetch-git, git, makeWrapper, + fetchgit, fetchhg, fetchbzr, fetchsvn }: + +with goPackages; + +buildGoPackage rec { + name = "go2nix-${version}"; + version = "20160307-${stdenv.lib.strings.substring 0 7 rev}"; + rev = "4c552dadd855e3694ed3499feb46dca9cd855f60"; + + goPackagePath = "github.com/kamilchm/go2nix"; + + src = fetchgit { + inherit rev; + url = "https://github.com/kamilchm/go2nix"; + sha256 = "1pwnm1vrjxvgl17pk9n1k5chmhgwxkrwp2s1bzi64xf12anibj63"; + }; + + goDeps = ./deps.json; + + buildInputs = [ go-bindata goimports makeWrapper ]; + preBuild = ''go generate ./...''; + + postInstall = '' + wrapProgram $bin/bin/go2nix \ + --prefix PATH : ${nix-prefetch-git}/bin \ + --prefix PATH : ${git}/bin + ''; + + allowGoReference = true; +} diff --git a/pkgs/development/tools/go2nix/deps.json b/pkgs/development/tools/go2nix/deps.json new file mode 100644 index 000000000000..8e7fefb17ee2 --- /dev/null +++ b/pkgs/development/tools/go2nix/deps.json @@ -0,0 +1,11 @@ +[ + { + "include": "../../libs.json", + "packages": [ + "github.com/alecthomas/template", + "github.com/alecthomas/units", + "gopkg.in/alecthomas/kingpin.v2", + "github.com/Masterminds/vcs" + ] + } +] diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 891472ae4c90..41a2534b4e67 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9628,7 +9628,7 @@ in goPackages = go16Packages; - go2nix = goPackages.go2nix.bin // { outputs = [ "bin" ]; }; + go2nix = callPackage ../development/tools/go2nix { }; ### DEVELOPMENT / LISP MODULES diff --git a/pkgs/top-level/go-packages.nix b/pkgs/top-level/go-packages.nix index 3602c68d908f..521452b55064 100644 --- a/pkgs/top-level/go-packages.nix +++ b/pkgs/top-level/go-packages.nix @@ -3241,25 +3241,6 @@ let goPackageAliases = [ "gopkg.in/alecthomas/kingpin.v2" ]; }; - go2nix = buildFromGitHub rec { - rev = "4c552dadd855e3694ed3499feb46dca9cd855f60"; - owner = "kamilchm"; - repo = "go2nix"; - sha256 = "1pwnm1vrjxvgl17pk9n1k5chmhgwxkrwp2s1bzi64xf12anibj63"; - - buildInputs = [ pkgs.makeWrapper go-bindata.bin tools.bin vcs go-spew gls go-difflib assertions goconvey testify kingpin ]; - - preBuild = ''go generate ./...''; - - postInstall = '' - wrapProgram $bin/bin/go2nix \ - --prefix PATH : ${pkgs.nix-prefetch-git}/bin \ - --prefix PATH : ${pkgs.git}/bin - ''; - - allowGoReference = true; - }; - godotenv = buildFromGitHub rec { rev = "4ed13390c0acd2ff4e371e64d8b97c8954138243"; version = "2015-09-07";