Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 53d688a3bfc0
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c5c8f17422ba
Choose a head ref
  • 3 commits
  • 8 files changed
  • 2 contributors

Commits on Jan 4, 2018

  1. ruby-modules: Add new url source type

    This just defers to `fetchurl` for fetching.
    
    Additionally, update the `nix-bundle-install.rb` script to handle gems
    installed from a path, i.e. those with a `url` source.
    Some parts of that script have been disabled in the `path` case
    that likely shouldn't be, but cause errors and aren't necessary to get
    `vagrant` to work.
    aneeshusa committed Jan 4, 2018
    Copy the full SHA
    0750c5a View commit details
  2. 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.
    aneeshusa committed Jan 4, 2018
    Copy the full SHA
    8c3553b View commit details

Commits on Jan 10, 2018

  1. Merge pull request #30952 from aneeshusa/build-vagrant-from-source

    Build vagrant from source
    zimbatm authored Jan 10, 2018

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c5c8f17 View commit details
25 changes: 18 additions & 7 deletions pkgs/development/ruby-modules/gem/default.nix
Original file line number Diff line number Diff line change
@@ -65,6 +65,8 @@ let
inherit (attrs.source) url rev sha256 fetchSubmodules;
leaveDotGit = true;
}
else if type == "url" then
fetchurl attrs.source
else
throw "buildRubyGem: don't know how to build a gem of type \"${type}\""
);
@@ -84,7 +86,8 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {

buildInputs = [
ruby makeWrapper
] ++ lib.optionals (type == "git") [ git bundler ]
] ++ lib.optionals (type == "git") [ git ]
++ lib.optionals (type != "gem") [ bundler ]
++ lib.optional stdenv.isDarwin darwin.libobjc
++ buildInputs;

@@ -159,14 +162,22 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
echo "buildFlags: $buildFlags"
${lib.optionalString (type == "url") ''
ruby ${./nix-bundle-install.rb} \
"path" \
'${gemName}' \
'${version}' \
'${lib.escapeShellArgs buildFlags}'
''}
${lib.optionalString (type == "git") ''
ruby ${./nix-bundle-install.rb} \
${gemName} \
${attrs.source.url} \
${src} \
${attrs.source.rev} \
${version} \
${lib.escapeShellArgs buildFlags}
"git" \
'${gemName}' \
'${version}' \
'${lib.escapeShellArgs buildFlags}' \
'${attrs.source.url}' \
'${src}' \
'${attrs.source.rev}'
''}
${lib.optionalString (type == "gem") ''
91 changes: 58 additions & 33 deletions pkgs/development/ruby-modules/gem/nix-bundle-install.rb
Original file line number Diff line number Diff line change
@@ -13,31 +13,46 @@

# Options:
#
# type - installation type, either "git" or "path"
# name - the gem name
# version - gem version
# build-flags - build arguments
#
# Git-only options:
#
# uri - git repo uri
# repo - path to local checkout
# ref - the commit hash
# version - gem version
# build-flags - build arguments

ruby = File.join(ENV["ruby"], "bin", RbConfig::CONFIG['ruby_install_name'])
out = ENV["out"]
bin_dir = File.join(ENV["out"], "bin")

name = ARGV[0]
uri = ARGV[1]
REPO = ARGV[2]
ref = ARGV[3]
version = ARGV[4]
build_flags = ARGV[5]
type = ARGV[0]
name = ARGV[1]
version = ARGV[2]
build_flags = ARGV[3]
if type == "git"
uri = ARGV[4]
REPO = ARGV[5]
ref = ARGV[6]
end

# options to pass to bundler
options = {
"name" => name,
"uri" => uri,
"ref" => ref,
"name" => name,
"version" => version,
}
if type == "path"
options.merge!({
"path" => Dir.pwd,
})
elsif type == "git"
options.merge!({
"uri" => uri,
"ref" => ref,
})
end

# Monkey-patch Bundler to use our local checkout.
# I wish we didn't have to do this, but bundler does not expose an API to do
@@ -63,26 +78,28 @@ def self.locked_gems
end
end

Bundler::Source::Git.class_eval do
def allow_git_ops?
true
if type == "git"
Bundler::Source::Git.class_eval do
def allow_git_ops?
true
end
end
end

Bundler::Source::Git::GitProxy.class_eval do
def checkout
unless path.exist?
FileUtils.mkdir_p(path.dirname)
FileUtils.cp_r(File.join(REPO, ".git"), path)
system("chmod -R +w #{path}")
Bundler::Source::Git::GitProxy.class_eval do
def checkout
unless path.exist?
FileUtils.mkdir_p(path.dirname)
FileUtils.cp_r(File.join(REPO, ".git"), path)
system("chmod -R +w #{path}")
end
end
end

def copy_to(destination, submodules=false)
unless File.exist?(destination.join(".git"))
FileUtils.mkdir_p(destination.dirname)
FileUtils.cp_r(REPO, destination)
system("chmod -R +w #{destination}")
def copy_to(destination, submodules=false)
unless File.exist?(destination.join(".git"))
FileUtils.mkdir_p(destination.dirname)
FileUtils.cp_r(REPO, destination)
system("chmod -R +w #{destination}")
end
end
end
end
@@ -94,7 +111,11 @@ def copy_to(destination, submodules=false)
Bundler.ui.level = "debug" if verbose

# Install
source = Bundler::Source::Git.new(options)
if type == "git"
source = Bundler::Source::Git.new(options)
else
source = Bundler::Source::Path.new(options)
end
spec = source.specs.search_all(name).first
Bundler.rubygems.with_build_args [build_flags] do
source.install(spec)
@@ -139,8 +160,10 @@ def copy_to(destination, submodules=false)
File.open("#{meta}/name", "w") do |f|
f.write spec.name
end
File.open("#{meta}/install-path", "w") do |f|
f.write source.install_path.to_s
if type == "git"
File.open("#{meta}/install-path", "w") do |f|
f.write source.install_path.to_s
end
end
File.open("#{meta}/require-paths", "w") do |f|
f.write spec.require_paths.join(" ")
@@ -150,8 +173,10 @@ def copy_to(destination, submodules=false)
end

# make the lib available during bundler/git installs
File.open("#{out}/nix-support/setup-hook", "a") do |f|
spec.require_paths.each do |dir|
f.puts("addToSearchPath RUBYLIB #{source.install_path}/#{dir}")
if type == "git"
File.open("#{out}/nix-support/setup-hook", "a") do |f|
spec.require_paths.each do |dir|
f.puts("addToSearchPath RUBYLIB #{source.install_path}/#{dir}")
end
end
end
2 changes: 2 additions & 0 deletions pkgs/development/tools/vagrant/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source "https://rubygems.org"
gem 'vagrant'
149 changes: 149 additions & 0 deletions pkgs/development/tools/vagrant/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
GIT
remote: https://github.com/mitchellh/vagrant-spec.git
revision: 7ac8b4191de578e345b29acaf62ecc72c8e73be1
specs:
vagrant-spec (0.0.1)
childprocess (~> 0.6.0)
log4r (~> 1.1.9)
rspec (~> 3.5.0)
thor (~> 0.18.1)

PATH
remote: .
specs:
vagrant (2.0.1)
childprocess (~> 0.6.0)
erubis (~> 2.7.0)
hashicorp-checkpoint (~> 0.1.1)
i18n (>= 0.6.0, <= 0.8.0)
listen (~> 3.1.5)
log4r (~> 1.1.9, < 1.1.11)
net-scp (~> 1.2.0)
net-sftp (~> 2.1)
net-ssh (~> 4.1.0)
rb-kqueue (~> 0.2.0)
rest-client (>= 1.6.0, < 3.0)
ruby_dep (<= 1.3.1)
wdm (~> 0.1.0)
winrm (~> 2.1)
winrm-elevated (~> 1.1)
winrm-fs (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
builder (3.2.3)
childprocess (0.6.3)
ffi (~> 1.0, >= 1.0.11)
crack (0.4.3)
safe_yaml (~> 1.0.0)
diff-lcs (1.3)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
erubis (2.7.0)
fake_ftp (0.1.1)
ffi (1.9.18)
gssapi (1.2.0)
ffi (>= 1.0.1)
gyoku (1.3.1)
builder (>= 2.1.2)
hashdiff (0.3.7)
hashicorp-checkpoint (0.1.4)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (0.8.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
little-plugger (1.1.4)
log4r (1.1.10)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
multi_json (1.12.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (4.1.0)
netrc (0.11.0)
nori (2.6.0)
public_suffix (3.0.1)
rake (12.0.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rb-kqueue (0.2.5)
ffi (>= 0.5.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-its (1.2.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
ruby_dep (1.3.1)
rubyntlm (0.6.2)
rubyzip (1.2.1)
safe_yaml (1.0.4)
thor (0.18.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.4)
wdm (0.1.1)
webmock (2.3.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
winrm (2.2.3)
builder (>= 2.1.2)
erubis (~> 2.7)
gssapi (~> 1.2)
gyoku (~> 1.0)
httpclient (~> 2.2, >= 2.2.0.2)
logging (>= 1.6.1, < 3.0)
nori (~> 2.0)
rubyntlm (~> 0.6.0, >= 0.6.1)
winrm-elevated (1.1.0)
winrm (~> 2.0)
winrm-fs (~> 1.0)
winrm-fs (1.1.1)
erubis (~> 2.7)
logging (>= 1.6.1, < 3.0)
rubyzip (~> 1.1)
winrm (~> 2.0)

PLATFORMS
ruby

DEPENDENCIES
fake_ftp (~> 0.1.1)
rake (~> 12.0.0)
rspec (~> 3.5.0)
rspec-its (~> 1.2.0)
vagrant!
vagrant-spec!
webmock (~> 2.3.1)

BUNDLED WITH
1.14.6
Loading