summary refs log tree commit diff
path: root/pkgs/development/tools/packer/default.nix
blob: 716b489d3d7703ee761f79a5a76135b8e7222489 (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
{ stdenv, lib, go, gox, fetchgit, fetchhg, fetchbzr, fetchFromGitHub }:

stdenv.mkDerivation rec {
  name = "packer-0.8.6";

  src = import ./deps.nix {
    inherit stdenv lib fetchgit fetchhg fetchbzr fetchFromGitHub;
  };

  buildInputs = [ go gox ];

  installPhase = ''
    export GOPATH=$src
    XC_ARCH=$(go env GOARCH)
    XC_OS=$(go env GOOS)

    mkdir -p $out/bin

    cd $src/src/github.com/mitchellh/packer
    gox \
        -os="''${XC_OS}" \
        -arch="''${XC_ARCH}" \
        -output "$out/bin/packer-{{.Dir}}" \
        ./...
    mv $out/bin/packer{*packer*,}
  '';

  meta = with stdenv.lib; {
    description = "A tool for creating identical machine images for multiple platforms from a single source configuration";
    homepage    = "http://www.packer.io";
    license     = licenses.mpl20;
    maintainers = with maintainers; [ cstrahan ];
    platforms   = platforms.unix;
  };
}