From a594f0bcd5a1e4a9bc36375caa5619130fa06ceb Mon Sep 17 00:00:00 2001 From: Luca Bruno Date: Wed, 4 Feb 2015 13:46:32 +0100 Subject: [PATCH] Port gox to buildGoPackage --- pkgs/development/compilers/go/gox.nix | 56 +++++++-------------------- pkgs/top-level/go-packages.nix | 12 ++++++ 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/pkgs/development/compilers/go/gox.nix b/pkgs/development/compilers/go/gox.nix index 932c3967726..5e0ff97eada 100644 --- a/pkgs/development/compilers/go/gox.nix +++ b/pkgs/development/compilers/go/gox.nix @@ -1,49 +1,19 @@ -{ stdenv, lib, go_1_3, fetchFromGitHub }: +{ lib, goPackages, fetchFromGitHub }: -let - goDeps = [ - { - root = "github.com/mitchellh/gox"; - src = fetchFromGitHub { - owner = "mitchellh"; - repo = "gox"; - rev = "c7329055e2aeb253a947e5cc876586ff4ca19199"; - sha256 = "0zhb88jjxqn3sdc4bpzvajqvgi9igp5gk03q12gaksaxhy2wl4jy"; - }; - } - { - root = "github.com/mitchellh/iochan"; - src = fetchFromGitHub { - owner = "mitchellh"; - repo = "iochan"; - rev = "b584a329b193e206025682ae6c10cdbe03b0cd77"; - sha256 = "1fcwdhfci41ibpng2j4c1bqfng578cwzb3c00yw1lnbwwhaq9r6b"; - }; - } - ]; - sources = stdenv.mkDerivation rec { - name = "go-deps"; - buildCommand = - lib.concatStrings - (map (dep: '' - mkdir -p $out/src/`dirname ${dep.root}` - ln -s ${dep.src} $out/src/${dep.root} - '') goDeps); +with goPackages; + +buildGoPackage rec { + rev = "c7329055e2aeb253a947e5cc876586ff4ca19199"; + name = "gox-${lib.strings.substring 0 7 rev}"; + goPackagePath = "github.com/mitchellh/gox"; + src = fetchFromGitHub { + inherit rev; + owner = "mitchellh"; + repo = "gox"; + sha256 = "0zhb88jjxqn3sdc4bpzvajqvgi9igp5gk03q12gaksaxhy2wl4jy"; }; -in -stdenv.mkDerivation rec { - name = "gox"; - - src = sources; - - propagatedBuildInputs = [ go_1_3 ]; - - installPhase = '' - mkdir -p $out/bin - export GOPATH=$src - go build -v -o $out/bin/gox github.com/mitchellh/gox - ''; + buildInputs = [ iochan ]; meta = with lib; { description = "A simple, no-frills tool for Go cross compilation that behaves a lot like standard go build"; diff --git a/pkgs/top-level/go-packages.nix b/pkgs/top-level/go-packages.nix index d08ebb452ed..b347252611d 100644 --- a/pkgs/top-level/go-packages.nix +++ b/pkgs/top-level/go-packages.nix @@ -216,6 +216,18 @@ let self = _self // overrides; _self = with self; { }; }; + iochan = buildGoPackage rec { + rev = "b584a329b193e206025682ae6c10cdbe03b0cd77"; + name = "iochan-${stdenv.lib.strings.substring 0 7 rev}"; + goPackagePath = "github.com/mitchellh/iochan"; + src = fetchFromGitHub { + inherit rev; + owner = "mitchellh"; + repo = "iochan"; + sha256 = "1fcwdhfci41ibpng2j4c1bqfng578cwzb3c00yw1lnbwwhaq9r6b"; + }; + }; + log4go = buildGoPackage rec { rev = "48"; name = "log4go-${rev}";