From 5ddafad13e62e7a14b0bf788549e5d36953ce4c0 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 31 Dec 2019 20:04:50 -0800 Subject: [PATCH 1/2] vagrant: Resolve crash by replacing gem symlinks with directories This workaround was discovered by painstakingly resolving the differences between a working installation and a non-working installation until a minimal change was found. I have no idea why it works. Fixes #76629. Signed-off-by: Anders Kaseorg --- pkgs/development/tools/vagrant/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/tools/vagrant/default.nix b/pkgs/development/tools/vagrant/default.nix index a7d9057d9f0..306d451abce 100644 --- a/pkgs/development/tools/vagrant/default.nix +++ b/pkgs/development/tools/vagrant/default.nix @@ -25,6 +25,17 @@ let inherit version; }; } // lib.optionalAttrs withLibvirt (import ./gemset_libvirt.nix)); + + # 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 `': uninitialized constant I18n::Config (NameError) + postBuild = '' + for gem in "$out"/lib/ruby/gems/*/gems/*; do + cp -a "$gem/" "$gem.new" + rm "$gem" + mv "$gem.new" "$gem" + done + ''; }; in buildRubyGem rec { From 2c70867d7798cfa67a148e2539d712a2e1f2e30d Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Tue, 31 Dec 2019 16:33:33 -0800 Subject: [PATCH 2/2] vagrant: Improve installCheckPhase to verify an actual operation Just running `vagrant --version` was insufficient to catch #76629, but this would have. Signed-off-by: Anders Kaseorg --- pkgs/development/tools/vagrant/default.nix | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkgs/development/tools/vagrant/default.nix b/pkgs/development/tools/vagrant/default.nix index 306d451abce..4ef723c9a1f 100644 --- a/pkgs/development/tools/vagrant/default.nix +++ b/pkgs/development/tools/vagrant/default.nix @@ -90,12 +90,7 @@ in buildRubyGem rec { ''; installCheckPhase = '' - if [[ "$("$out/bin/vagrant" --version)" == "Vagrant ${version}" ]]; then - echo 'Vagrant smoke check passed' - else - echo 'Vagrant smoke check failed' - return 1 - fi + HOME="$(mktemp -d)" $out/bin/vagrant init --output - > /dev/null ''; # `patchShebangsAuto` patches this one script which is intended to run