nixpkgs/pkgs/development/tools/packer/default.nix

54 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv, lib, gox, gotools, buildGoPackage, fetchFromGitHub
2016-05-13 09:25:01 +01:00
, fetchgit, fetchhg, fetchbzr, fetchsvn }:
2014-05-14 00:19:41 +01:00
stdenv.mkDerivation rec {
2016-05-13 09:25:01 +01:00
name = "packer-${version}";
version = "0.10.1";
2014-05-14 00:19:41 +01:00
src = (import ./deps.nix {
inherit stdenv lib gox gotools buildGoPackage fetchgit fetchhg fetchbzr fetchsvn;
}).out;
2014-05-14 00:19:41 +01:00
buildInputs = [ src.go gox gotools ];
2014-05-14 00:19:41 +01:00
2016-05-13 09:25:01 +01:00
configurePhase = ''
export GOPATH=$PWD/share/go
export XC_ARCH=$(go env GOARCH)
export XC_OS=$(go env GOOS)
2014-05-14 00:19:41 +01:00
2016-05-13 09:25:01 +01:00
mkdir $GOPATH/bin
cd $GOPATH/src/github.com/mitchellh/packer
# Don't fetch the deps
substituteInPlace "Makefile" --replace ': deps' ':'
# Avoid using git
sed \
-e "s|GITBRANCH:=.*||" \
-e "s|GITSHA:=.*|GITSHA=${src.rev}|" \
-i Makefile
sed \
-e "s|GIT_COMMIT=.*|GIT_COMMIT=${src.rev}|" \
-e "s|GIT_DIRTY=.*|GIT_DIRTY=|" \
-i "scripts/build.sh"
'';
buildPhase = ''
make generate releasebin
'';
2014-05-14 00:19:41 +01:00
2016-05-13 09:25:01 +01:00
installPhase = ''
mkdir -p $out/bin
mv bin/* $out/bin
2014-05-14 00:19:41 +01:00
'';
meta = with stdenv.lib; {
description = "A tool for creating identical machine images for multiple platforms from a single source configuration";
2016-05-13 09:25:01 +01:00
homepage = http://www.packer.io;
2014-05-14 00:19:41 +01:00
license = licenses.mpl20;
2016-05-13 09:25:01 +01:00
maintainers = with maintainers; [ cstrahan zimbatm ];
2014-05-14 00:19:41 +01:00
platforms = platforms.unix;
};
}