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

108 lines
3.7 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, dpkg, curl, libarchive, openssl, ruby, buildRubyGem, libiconv
, libxml2, libxslt, makeWrapper }:
2013-11-21 22:21:39 +00:00
assert stdenv.system == "x86_64-linux" || stdenv.system == "i686-linux";
2014-11-18 04:24:07 +00:00
let
2015-12-22 10:28:46 +00:00
version = "1.8.0";
2014-11-18 04:24:07 +00:00
rake = buildRubyGem {
inherit ruby;
2015-12-22 10:28:46 +00:00
name = "rake-10.4.2";
sha256 = "1rn03rqlf1iv6n87a78hkda2yqparhhaivfjpizblmxvlw2hk5r8";
2014-11-18 04:24:07 +00:00
};
2014-09-04 18:24:21 +00:00
in
2013-11-21 22:21:39 +00:00
stdenv.mkDerivation rec {
2014-09-04 18:24:21 +00:00
name = "vagrant-${version}";
2013-11-21 22:21:39 +00:00
src =
if stdenv.system == "x86_64-linux" then
fetchurl {
2015-12-22 10:28:46 +00:00
url = "https://releases.hashicorp.com/vagrant/${version}/vagrant_${version}_x86_64.deb";
sha256 = "0hvi6db5lphgzsykm1wn76jj4wwmm6lshvvd0qz7ipyyyhnd7sjp";
2013-11-21 22:21:39 +00:00
}
else
fetchurl {
2015-12-22 10:28:46 +00:00
url = "https://releases.hashicorp.com/vagrant/${version}/vagrant_${version}_i686.deb";
sha256 = "1jvscbxqbhavw4q81y5718qbyj74b9lwfw3gb4c1f4jmgm08wxxk";
2013-11-21 22:21:39 +00:00
};
meta = with stdenv.lib; {
description = "A tool for building complete development environments";
homepage = http://vagrantup.com;
license = licenses.mit;
2015-06-22 06:25:07 +00:00
maintainers = with maintainers; [ lovek323 globin jgeerds ];
2013-11-21 22:21:39 +00:00
platforms = platforms.linux;
};
buildInputs = [ makeWrapper ];
2013-11-21 22:21:39 +00:00
unpackPhase = ''
${dpkg}/bin/dpkg-deb -x ${src} .
'';
buildPhase = false;
installPhase = ''
sed -i "s|/opt|$out/opt|" usr/bin/vagrant
# overwrite embedded binaries
2015-12-22 10:28:46 +00:00
# curl: curl, curl-config
rm opt/vagrant/embedded/bin/{curl,curl-config}
2013-11-21 22:21:39 +00:00
ln -s ${curl}/bin/curl opt/vagrant/embedded/bin
2015-12-22 10:28:46 +00:00
ln -s ${curl}/bin/curl-config opt/vagrant/embedded/bin
2013-11-21 22:21:39 +00:00
# libarchive: bsdtar, bsdcpio
rm opt/vagrant/embedded/bin/{bsdtar,bsdcpio}
ln -s ${libarchive}/bin/bsdtar opt/vagrant/embedded/bin
ln -s ${libarchive}/bin/bsdcpio opt/vagrant/embedded/bin
# openssl: c_rehash, openssl
rm opt/vagrant/embedded/bin/{c_rehash,openssl}
ln -s ${openssl}/bin/c_rehash opt/vagrant/embedded/bin
ln -s ${openssl}/bin/openssl opt/vagrant/embedded/bin
2015-12-22 10:28:46 +00:00
# ruby: erb, gem, irb, rake, rdoc, ri, ruby
rm opt/vagrant/embedded/bin/{erb,gem,irb,rake,rdoc,ri,ruby}
2013-11-21 22:21:39 +00:00
ln -s ${ruby}/bin/erb opt/vagrant/embedded/bin
ln -s ${ruby}/bin/gem opt/vagrant/embedded/bin
ln -s ${ruby}/bin/irb opt/vagrant/embedded/bin
2014-11-18 04:24:07 +00:00
ln -s ${rake}/bin/rake opt/vagrant/embedded/bin
2013-11-21 22:21:39 +00:00
ln -s ${ruby}/bin/rdoc opt/vagrant/embedded/bin
ln -s ${ruby}/bin/ri opt/vagrant/embedded/bin
ln -s ${ruby}/bin/ruby opt/vagrant/embedded/bin
# libiconv: iconv
rm opt/vagrant/embedded/bin/iconv
ln -s ${libiconv}/bin/iconv opt/vagrant/embedded/bin
2013-11-21 22:21:39 +00:00
# libxml: xml2-config, xmlcatalog, xmllint
rm opt/vagrant/embedded/bin/{xml2-config,xmlcatalog,xmllint}
ln -s ${libxml2}/bin/xml2-config opt/vagrant/embedded/bin
ln -s ${libxml2}/bin/xmlcatalog opt/vagrant/embedded/bin
ln -s ${libxml2}/bin/xmllint opt/vagrant/embedded/bin
# libxslt: xslt-config, xsltproc
rm opt/vagrant/embedded/bin/{xslt-config,xsltproc}
ln -s ${libxslt}/bin/xslt-config opt/vagrant/embedded/bin
ln -s ${libxslt}/bin/xsltproc opt/vagrant/embedded/bin
mkdir -p "$out"
cp -r opt "$out"
cp -r usr/bin "$out"
wrapProgram $out/bin/vagrant --prefix LD_LIBRARY_PATH : $out/opt/vagrant/embedded/lib
2013-11-21 22:21:39 +00:00
'';
2014-07-15 00:47:11 +00:00
preFixup = ''
# 'hide' the template file from shebang-patching
2015-12-22 10:28:46 +00:00
chmod -x $out/opt/vagrant/embedded/gems/gems/bundler-1.10.6/lib/bundler/templates/Executable
2015-04-29 11:15:17 +00:00
chmod -x $out/opt/vagrant/embedded/gems/gems/vagrant-${version}/plugins/provisioners/salt/bootstrap-salt.sh
2014-07-15 00:47:11 +00:00
'';
postFixup = ''
2015-12-22 10:28:46 +00:00
chmod +x $out/opt/vagrant/embedded/gems/gems/bundler-1.10.6/lib/bundler/templates/Executable
2015-04-29 11:15:17 +00:00
chmod +x $out/opt/vagrant/embedded/gems/gems/vagrant-${version}/plugins/provisioners/salt/bootstrap-salt.sh
2014-07-15 00:47:11 +00:00
'';
2013-11-21 22:21:39 +00:00
}