2019-02-15 18:07:01 +01:00
|
|
|
{ stdenv, lib, fetchurl, buildRubyGem, bundlerEnv, ruby, libarchive
|
2020-02-05 19:27:16 +01:00
|
|
|
, libguestfs, qemu, writeText, withLibvirt ? stdenv.isLinux, fetchpatch
|
|
|
|
}:
|
2013-11-21 23:21:39 +01:00
|
|
|
|
2014-11-18 05:24:07 +01:00
|
|
|
let
|
2018-07-16 03:22:29 +02:00
|
|
|
# NOTE: bumping the version and updating the hash is insufficient;
|
2018-09-29 13:48:35 +02:00
|
|
|
# you must use bundix to generate a new gemset.nix in the Vagrant source.
|
2020-02-05 19:27:16 +01:00
|
|
|
version = "2.2.7";
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
url = "https://github.com/hashicorp/vagrant/archive/v${version}.tar.gz";
|
2020-02-05 19:27:16 +01:00
|
|
|
sha256 = "1z31y1nqiyj6rml9lz8gcbr29myhs5wcap8jsvgm3pb7p9p9y8m9";
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
|
|
|
|
deps = bundlerEnv rec {
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
pname = "vagrant";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
inherit ruby;
|
2018-09-29 13:48:35 +02:00
|
|
|
gemfile = writeText "Gemfile" "";
|
|
|
|
lockfile = writeText "Gemfile.lock" "";
|
2018-10-27 08:28:58 +02:00
|
|
|
gemset = lib.recursiveUpdate (import ./gemset.nix) ({
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
vagrant = {
|
|
|
|
source = {
|
|
|
|
type = "url";
|
|
|
|
inherit url sha256;
|
|
|
|
};
|
|
|
|
inherit version;
|
|
|
|
};
|
2018-10-27 08:28:58 +02:00
|
|
|
} // lib.optionalAttrs withLibvirt (import ./gemset_libvirt.nix));
|
2020-01-01 05:04:50 +01:00
|
|
|
|
|
|
|
# This replaces the gem symlinks with directories, resolving this
|
|
|
|
# error when running vagrant (I have no idea why):
|
|
|
|
# /nix/store/p4hrycs0zaa9x0gsqylbk577ppnryixr-vagrant-2.2.6/lib/ruby/gems/2.6.0/gems/i18n-1.1.1/lib/i18n/config.rb:6:in `<module:I18n>': uninitialized constant I18n::Config (NameError)
|
|
|
|
postBuild = ''
|
|
|
|
for gem in "$out"/lib/ruby/gems/*/gems/*; do
|
|
|
|
cp -a "$gem/" "$gem.new"
|
|
|
|
rm "$gem"
|
2020-01-14 13:15:17 +01:00
|
|
|
# needed on macOS, otherwise the mv yields permission denied
|
|
|
|
chmod +w "$gem.new"
|
2020-01-01 05:04:50 +01:00
|
|
|
mv "$gem.new" "$gem"
|
|
|
|
done
|
|
|
|
'';
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
};
|
2014-11-18 05:24:07 +01:00
|
|
|
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
in buildRubyGem rec {
|
|
|
|
name = "${gemName}-${version}";
|
|
|
|
gemName = "vagrant";
|
|
|
|
inherit version;
|
2016-10-09 21:23:32 +02:00
|
|
|
|
2018-03-04 08:28:45 +01:00
|
|
|
doInstallCheck = true;
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
dontBuild = false;
|
|
|
|
src = fetchurl { inherit url sha256; };
|
2016-09-05 14:44:34 +02:00
|
|
|
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
patches = [
|
2019-03-05 15:44:40 +01:00
|
|
|
./unofficial-installation-nowarn.patch
|
2018-08-28 07:57:19 +02:00
|
|
|
./use-system-bundler-version.patch
|
2018-12-17 00:51:30 +01:00
|
|
|
./0004-Support-system-installed-plugins.patch
|
2020-02-05 19:27:16 +01:00
|
|
|
|
|
|
|
# fix deprecation warning on ruby 2.6.5.
|
|
|
|
# See also https://github.com/hashicorp/vagrant/pull/11307
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/hashicorp/vagrant/commit/d18ed567aaa5da23c9e91ab87f360e7bf6760f13.patch";
|
|
|
|
sha256 = "0f61qj41rc3fdggmnha4jrqg4pzmfiriwpsz4fcgf7c0bx6qha7q";
|
|
|
|
})
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
];
|
2016-09-05 14:44:34 +02:00
|
|
|
|
2018-12-17 00:51:30 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace lib/vagrant/plugin/manager.rb --subst-var-by \
|
|
|
|
system_plugin_dir "$out/vagrant-plugins"
|
|
|
|
'';
|
|
|
|
|
2018-01-28 00:47:43 +01:00
|
|
|
# PATH additions:
|
|
|
|
# - libarchive: Make `bsdtar` available for extracting downloaded boxes
|
2019-01-02 05:03:20 +01:00
|
|
|
# withLibvirt only:
|
|
|
|
# - libguestfs: Make 'virt-sysprep' available for 'vagrant package'
|
|
|
|
# - qemu: Make 'qemu-img' available for 'vagrant package'
|
|
|
|
postInstall =
|
|
|
|
let
|
|
|
|
pathAdditions = lib.makeSearchPath "bin"
|
2019-09-09 01:38:31 +02:00
|
|
|
(map (x: lib.getBin x) ([
|
2019-01-02 05:03:20 +01:00
|
|
|
libarchive
|
|
|
|
] ++ lib.optionals withLibvirt [
|
|
|
|
libguestfs
|
|
|
|
qemu
|
|
|
|
]));
|
|
|
|
in ''
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
wrapProgram "$out/bin/vagrant" \
|
2018-01-28 00:47:43 +01:00
|
|
|
--set GEM_PATH "${deps}/lib/ruby/gems/${ruby.version.libDir}" \
|
2019-01-02 05:03:20 +01:00
|
|
|
--prefix PATH ':' ${pathAdditions}
|
2018-12-17 00:51:30 +01:00
|
|
|
|
|
|
|
mkdir -p "$out/vagrant-plugins/plugins.d"
|
|
|
|
echo '{}' > "$out/vagrant-plugins/plugins.json"
|
2019-07-27 13:58:00 +02:00
|
|
|
|
|
|
|
mkdir -p $out/share/bash-completion/completions/
|
|
|
|
cp -av contrib/bash/completion.sh $out/share/bash-completion/completions/vagrant
|
2018-12-17 01:16:20 +01:00
|
|
|
'' +
|
|
|
|
lib.optionalString withLibvirt ''
|
|
|
|
substitute ${./vagrant-libvirt.json.in} $out/vagrant-plugins/plugins.d/vagrant-libvirt.json \
|
|
|
|
--subst-var-by ruby_version ${ruby.version} \
|
|
|
|
--subst-var-by vagrant_version ${version}
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
'';
|
2013-11-21 23:21:39 +01:00
|
|
|
|
2018-03-04 08:28:45 +01:00
|
|
|
installCheckPhase = ''
|
2020-01-01 01:33:33 +01:00
|
|
|
HOME="$(mktemp -d)" $out/bin/vagrant init --output - > /dev/null
|
2018-03-04 08:28:45 +01:00
|
|
|
'';
|
|
|
|
|
2019-06-19 19:06:56 +02:00
|
|
|
# `patchShebangsAuto` patches this one script which is intended to run
|
|
|
|
# on foreign systems.
|
|
|
|
postFixup = ''
|
|
|
|
sed -i -e '1c#!/bin/sh -' \
|
|
|
|
$out/lib/ruby/gems/*/gems/vagrant-*/plugins/provisioners/salt/bootstrap-salt.sh
|
|
|
|
'';
|
|
|
|
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
passthru = {
|
|
|
|
inherit ruby deps;
|
2016-09-05 14:44:34 +02:00
|
|
|
};
|
|
|
|
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
meta = with lib; {
|
2013-11-21 23:21:39 +01:00
|
|
|
description = "A tool for building complete development environments";
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
homepage = https://www.vagrantup.com/;
|
|
|
|
license = licenses.mit;
|
2020-02-05 19:27:16 +01:00
|
|
|
maintainers = with maintainers; [ aneeshusa ma27 ];
|
vagrant: Build from source
This is not quite as elegant as using `bundlerApp`,
which I could not get working.
However, this still uses most of the Ruby infrastructure,
including stock bundix, and should be fairly reasonable to maintain.
This means no more hacks to work around wrong embedded binaries,
and no need for an old version of Ruby.
Note that `vagrant share` is no longer included,
as that functionality is closed-source
and not present in the upstream source code.
The Vagrant maintainers publish official Vagrant installers,
which they prefer people use as most platforms don't
have great support for pinning known-good dependencies.
When run outside one of the offical installers,
Vagrant normally prints a warning to that effect.
However, Vagrant does run outside the installer environment
(nominally to support Vagrant development),
and this has the effect of functioning better by respecting
OS certs and shared libraries,
as opposed to trying to use bundled versions.
To keep these postive side effects without having to see the warning
on every Vagrant invocation, patch out the call to print the warning.
Note that I have reset the maintainers since the implementation is
totally redone; I'm happy to re-add any of the current maintainers.
2017-10-30 07:21:07 +01:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2013-11-21 23:21:39 +01:00
|
|
|
};
|
|
|
|
}
|