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.

authored by

Aneesh Agrawal and committed by
Franz Pletz
746b591c cb54b19c

+10 -7
+10 -7
pkgs/development/tools/vagrant/default.nix
··· 15 in 16 stdenv.mkDerivation rec { 17 name = "vagrant-${version}"; 18 19 src = 20 if stdenv.system == "x86_64-linux" then ··· 39 buildInputs = [ makeWrapper ]; 40 41 unpackPhase = '' 42 - ${dpkg}/bin/dpkg-deb -x ${src} . 43 ''; 44 45 - buildPhase = false; 46 47 installPhase = '' 48 sed -i "s|/opt|$out/opt|" usr/bin/vagrant ··· 55 ln -s ${curl.dev}/bin/curl-config opt/vagrant/embedded/bin 56 57 # libarchive: bsdtar, bsdcpio 58 rm opt/vagrant/embedded/bin/{bsdtar,bsdcpio} 59 ln -s ${libarchive}/bin/bsdtar opt/vagrant/embedded/bin 60 ln -s ${libarchive}/bin/bsdcpio opt/vagrant/embedded/bin ··· 92 mkdir -p "$out" 93 cp -r opt "$out" 94 cp -r usr/bin "$out" 95 - wrapProgram $out/bin/vagrant --prefix LD_LIBRARY_PATH : $out/opt/vagrant/embedded/lib 96 ''; 97 98 preFixup = '' 99 # 'hide' the template file from shebang-patching 100 - chmod -x $out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable 101 - chmod -x $out/opt/vagrant/embedded/gems/gems/vagrant-${version}/plugins/provisioners/salt/bootstrap-salt.sh 102 ''; 103 104 postFixup = '' 105 - chmod +x $out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable 106 - chmod +x $out/opt/vagrant/embedded/gems/gems/vagrant-${version}/plugins/provisioners/salt/bootstrap-salt.sh 107 ''; 108 }
··· 15 in 16 stdenv.mkDerivation rec { 17 name = "vagrant-${version}"; 18 + inherit version; 19 20 src = 21 if stdenv.system == "x86_64-linux" then ··· 40 buildInputs = [ makeWrapper ]; 41 42 unpackPhase = '' 43 + ${dpkg}/bin/dpkg-deb -x "$src" . 44 ''; 45 46 + buildPhase = ""; 47 48 installPhase = '' 49 sed -i "s|/opt|$out/opt|" usr/bin/vagrant ··· 56 ln -s ${curl.dev}/bin/curl-config opt/vagrant/embedded/bin 57 58 # libarchive: bsdtar, bsdcpio 59 + rm opt/vagrant/embedded/lib/libarchive* 60 + ln -s ${libarchive}/lib/libarchive.so opt/vagrant/embedded/lib/libarchive.so 61 rm opt/vagrant/embedded/bin/{bsdtar,bsdcpio} 62 ln -s ${libarchive}/bin/bsdtar opt/vagrant/embedded/bin 63 ln -s ${libarchive}/bin/bsdcpio opt/vagrant/embedded/bin ··· 95 mkdir -p "$out" 96 cp -r opt "$out" 97 cp -r usr/bin "$out" 98 + wrapProgram "$out/bin/vagrant" --prefix LD_LIBRARY_PATH : "$out/opt/vagrant/embedded/lib" 99 ''; 100 101 preFixup = '' 102 # 'hide' the template file from shebang-patching 103 + chmod -x "$out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable" 104 + chmod -x "$out/opt/vagrant/embedded/gems/gems/vagrant-$version/plugins/provisioners/salt/bootstrap-salt.sh" 105 ''; 106 107 postFixup = '' 108 + chmod +x "$out/opt/vagrant/embedded/gems/gems/bundler-1.12.5/lib/bundler/templates/Executable" 109 + chmod +x "$out/opt/vagrant/embedded/gems/gems/vagrant-$version/plugins/provisioners/salt/bootstrap-salt.sh" 110 ''; 111 }