mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 01:51:24 +00:00
943d59268a
* Remove duplicate "packer" source * Use the same version of go everywhere
54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ stdenv, lib, gox, gotools, buildGoPackage, fetchFromGitHub
|
|
, fetchgit, fetchhg, fetchbzr, fetchsvn }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "packer-${version}";
|
|
version = "0.10.1";
|
|
|
|
src = import ./deps.nix {
|
|
inherit stdenv lib gox gotools buildGoPackage fetchgit fetchhg fetchbzr fetchsvn;
|
|
};
|
|
|
|
buildInputs = [ src.go gox gotools ];
|
|
|
|
configurePhase = ''
|
|
export GOPATH=$PWD/share/go
|
|
export XC_ARCH=$(go env GOARCH)
|
|
export XC_OS=$(go env GOOS)
|
|
|
|
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
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
mv bin/* $out/bin
|
|
'';
|
|
|
|
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 zimbatm ];
|
|
platforms = platforms.unix;
|
|
};
|
|
}
|