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 15 in 16 16 stdenv.mkDerivation rec { 17 17 name = "vagrant-${version}"; 18 + inherit version; 18 19 19 20 src = 20 21 if stdenv.system == "x86_64-linux" then ··· 39 40 buildInputs = [ makeWrapper ]; 40 41 41 42 unpackPhase = '' 42 - ${dpkg}/bin/dpkg-deb -x ${src} . 43 + ${dpkg}/bin/dpkg-deb -x "$src" . 43 44 ''; 44 45 45 - buildPhase = false; 46 + buildPhase = ""; 46 47 47 48 installPhase = '' 48 49 sed -i "s|/opt|$out/opt|" usr/bin/vagrant ··· 55 56 ln -s ${curl.dev}/bin/curl-config opt/vagrant/embedded/bin 56 57 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 58 61 rm opt/vagrant/embedded/bin/{bsdtar,bsdcpio} 59 62 ln -s ${libarchive}/bin/bsdtar opt/vagrant/embedded/bin 60 63 ln -s ${libarchive}/bin/bsdcpio opt/vagrant/embedded/bin ··· 92 95 mkdir -p "$out" 93 96 cp -r opt "$out" 94 97 cp -r usr/bin "$out" 95 - wrapProgram $out/bin/vagrant --prefix LD_LIBRARY_PATH : $out/opt/vagrant/embedded/lib 98 + wrapProgram "$out/bin/vagrant" --prefix LD_LIBRARY_PATH : "$out/opt/vagrant/embedded/lib" 96 99 ''; 97 100 98 101 preFixup = '' 99 102 # '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 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" 102 105 ''; 103 106 104 107 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 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" 107 110 ''; 108 111 }