1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

vagrant: use libarchive lib from Nix (#17597)

We currently already replace the embedded bsdtar binaries with the
corresponding ones from Nix. However, we also need to replace the
libarchive shared library to prevent version mismatches between the
embedded library and the Nix binaries.

Also expose version on the derivation and use environment variables
to make overriding the derivation easier.
This commit is contained in:
Aneesh Agrawal 2016-08-09 06:01:48 -04:00 committed by Franz Pletz
parent cb54b19c4d
commit 746b591c68

View file

@ -15,6 +15,7 @@ let
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "vagrant-${version}"; name = "vagrant-${version}";
inherit version;
src = src =
if stdenv.system == "x86_64-linux" then if stdenv.system == "x86_64-linux" then
@ -39,10 +40,10 @@ stdenv.mkDerivation rec {
buildInputs = [ makeWrapper ]; buildInputs = [ makeWrapper ];
unpackPhase = '' unpackPhase = ''
${dpkg}/bin/dpkg-deb -x ${src} . ${dpkg}/bin/dpkg-deb -x "$src" .
''; '';
buildPhase = false; buildPhase = "";
installPhase = '' installPhase = ''
sed -i "s|/opt|$out/opt|" usr/bin/vagrant sed -i "s|/opt|$out/opt|" usr/bin/vagrant
@ -55,6 +56,8 @@ stdenv.mkDerivation rec {
ln -s ${curl.dev}/bin/curl-config opt/vagrant/embedded/bin ln -s ${curl.dev}/bin/curl-config opt/vagrant/embedded/bin
# libarchive: bsdtar, bsdcpio # libarchive: bsdtar, bsdcpio
rm opt/vagrant/embedded/lib/libarchive*
ln -s ${libarchive}/lib/libarchive.so opt/vagrant/embedded/lib/libarchive.so
rm opt/vagrant/embedded/bin/{bsdtar,bsdcpio} rm opt/vagrant/embedded/bin/{bsdtar,bsdcpio}
ln -s ${libarchive}/bin/bsdtar opt/vagrant/embedded/bin ln -s ${libarchive}/bin/bsdtar opt/vagrant/embedded/bin
ln -s ${libarchive}/bin/bsdcpio opt/vagrant/embedded/bin ln -s ${libarchive}/bin/bsdcpio opt/vagrant/embedded/bin
@ -92,17 +95,17 @@ stdenv.mkDerivation rec {
mkdir -p "$out" mkdir -p "$out"
cp -r opt "$out" cp -r opt "$out"
cp -r usr/bin "$out" cp -r usr/bin "$out"
wrapProgram $out/bin/vagrant --prefix LD_LIBRARY_PATH : $out/opt/vagrant/embedded/lib wrapProgram "$out/bin/vagrant" --prefix LD_LIBRARY_PATH : "$out/opt/vagrant/embedded/lib"
''; '';
preFixup = '' preFixup = ''
# 'hide' the template file from shebang-patching # 'hide' the template file from shebang-patching
chmod -x $out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable chmod -x "$out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable"
chmod -x $out/opt/vagrant/embedded/gems/gems/vagrant-${version}/plugins/provisioners/salt/bootstrap-salt.sh chmod -x "$out/opt/vagrant/embedded/gems/gems/vagrant-$version/plugins/provisioners/salt/bootstrap-salt.sh"
''; '';
postFixup = '' postFixup = ''
chmod +x $out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable chmod +x "$out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable"
chmod +x $out/opt/vagrant/embedded/gems/gems/vagrant-${version}/plugins/provisioners/salt/bootstrap-salt.sh chmod +x "$out/opt/vagrant/embedded/gems/gems/vagrant-$version/plugins/provisioners/salt/bootstrap-salt.sh"
''; '';
} }