nixpkgs/pkgs/development/tools/vagrant/default.nix
Aneesh Agrawal 8c3553b88d 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.
2018-01-04 08:00:51 -08:00

55 lines
1.2 KiB
Nix

{ lib, fetchurl, buildRubyGem, bundlerEnv, ruby }:
let
version = "2.0.1";
url = "https://github.com/hashicorp/vagrant/archive/v${version}.tar.gz";
sha256 = "1fjfl00n4rsq6khypm56g0vq6l153q128r35zky2ba30bz292ar1";
deps = bundlerEnv rec {
name = "${pname}-${version}";
pname = "vagrant";
inherit version;
inherit ruby;
gemdir = ./.;
gemset = lib.recursiveUpdate (import ./gemset.nix) {
vagrant = {
source = {
type = "url";
inherit url sha256;
};
inherit version;
};
};
};
in buildRubyGem rec {
name = "${gemName}-${version}";
gemName = "vagrant";
inherit version;
doCheck = true;
dontBuild = false;
src = fetchurl { inherit url sha256; };
patches = [
./unofficial-installation-nowarn.patch
];
postInstall = ''
wrapProgram "$out/bin/vagrant" \
--set GEM_PATH "${deps}/lib/ruby/gems/${ruby.version.libDir}"
'';
passthru = {
inherit ruby deps;
};
meta = with lib; {
description = "A tool for building complete development environments";
homepage = https://www.vagrantup.com/;
license = licenses.mit;
maintainers = with maintainers; [ aneeshusa ];
platforms = with platforms; linux ++ darwin;
};
}