summary refs log tree commit diff
path: root/pkgs/development/compilers/go/gox.nix
blob: da40b7570fe588c905c583cfaff5bd9d2e0fa35e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ stdenv, lib, go, 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);
  };
in

stdenv.mkDerivation rec {
  name = "gox";

  src = sources;

  propagatedBuildInputs = [ go ];

  installPhase = ''
    mkdir -p $out/bin
    export GOPATH=$src
    go build -v -o $out/bin/gox github.com/mitchellh/gox
  '';

  meta = with lib; {
    description = "A simple, no-frills tool for Go cross compilation that behaves a lot like standard go build";
    homepage    = https://github.com/mitchellh/gox;
    maintainers = with maintainers; [ cstrahan ];
    platforms   = platforms.unix;
  };
}