Merge branch 'master' of github.com:nixos/nixpkgs into pleasant-ruby
Conflicts: pkgs/applications/version-management/git-and-tools/default.nix pkgs/applications/version-management/git-and-tools/hub/default.nix pkgs/tools/audio/mpdcron/default.nix
This commit is contained in:
@@ -120,6 +120,25 @@ let
|
||||
instantiate (attrs // { inherit name; })
|
||||
);
|
||||
|
||||
needsPreInstall = attrs:
|
||||
(attrs ? preInstall) || (attrs ? buildInputs);
|
||||
|
||||
createPreInstallers = lib.fold (next: acc:
|
||||
if !needsPreInstall next
|
||||
then acc
|
||||
else acc + ''
|
||||
cp ${writeScript "${next.name}-pre-install" ''
|
||||
#!/bin/sh
|
||||
buildInputs="${toString (next.buildInputs or [])}"
|
||||
source ${stdenv}/setup
|
||||
|
||||
${next.preInstall or ""}
|
||||
|
||||
${ruby}/bin/ruby -e 'ENV.inspect' > env/${next.name}
|
||||
''} pre-installers/${next.name}
|
||||
''
|
||||
) "" (attrValues instantiated);
|
||||
|
||||
# copy *.gem to ./gems
|
||||
copyGems = lib.fold (next: acc:
|
||||
if next.source.type == "gem"
|
||||
@@ -190,8 +209,6 @@ let
|
||||
|
||||
# rewrite PATH sources to point into the nix store.
|
||||
purifiedLockfile = runRuby "purifiedLockfile" {} ''
|
||||
#!${ruby}/bin/ruby
|
||||
|
||||
out = ENV['out']
|
||||
sources = eval(File.read("${sources}"))
|
||||
paths = sources["path"]
|
||||
@@ -238,6 +255,10 @@ stdenv.mkDerivation {
|
||||
mkdir gems
|
||||
${copyGems}
|
||||
|
||||
mkdir env
|
||||
mkdir pre-installers
|
||||
${createPreInstallers}
|
||||
|
||||
mkdir $out/bin
|
||||
cp ${./monkey_patches.rb} monkey_patches.rb
|
||||
export RUBYOPT="-rmonkey_patches.rb -I $(pwd -P)"
|
||||
|
||||
@@ -75,6 +75,8 @@ g: # Get dependencies from patched gems
|
||||
jsduck = g.jsduck_5_3_4;
|
||||
json = g.json_1_8_1;
|
||||
json_pure = g.json_pure_1_8_0;
|
||||
kitchen_ansible = g.kitchen_ansible_0_0_4;
|
||||
kitchen_vagrant = g.kitchen_vagrant_0_15_0;
|
||||
kramdown = g.kramdown_1_5_0;
|
||||
launchy = g.launchy_2_4_3;
|
||||
liquid = g.liquid_2_6_1;
|
||||
@@ -90,12 +92,14 @@ g: # Get dependencies from patched gems
|
||||
mini_portile = g.mini_portile_0_6_1;
|
||||
minitar = g.minitar_0_5_4;
|
||||
minitest = g.minitest_5_5_0;
|
||||
mixlib_shellout = g.mixlib_shellout_1_6_1;
|
||||
multi_json = g.multi_json_1_10_1;
|
||||
multi_test = g.multi_test_0_1_1;
|
||||
multipart_post = g.multipart_post_2_0_0;
|
||||
net_http_digest_auth = g.net_http_digest_auth_1_4;
|
||||
net_http_persistent = g.net_http_persistent_2_9_4;
|
||||
net_http_pipeline = g.net_http_pipeline_1_0_1;
|
||||
net_scp = g.net_scp_1_2_1;
|
||||
net_sftp = g.net_sftp_2_1_2;
|
||||
net_ssh = g.net_ssh_2_9_1;
|
||||
netrc = g.netrc_0_10_1;
|
||||
@@ -151,6 +155,7 @@ g: # Get dependencies from patched gems
|
||||
taskjuggler = g.taskjuggler_3_5_0;
|
||||
term_ansicolor = g.term_ansicolor_1_3_0;
|
||||
terminal_notifier = g.terminal_notifier_1_6_2;
|
||||
test_kitchen = g.test_kitchen_1_2_1;
|
||||
text = g.text_1_3_0;
|
||||
thin = g.thin_1_6_3;
|
||||
thor = g.thor_0_19_1;
|
||||
@@ -176,7 +181,7 @@ g: # Get dependencies from patched gems
|
||||
xml_simple = g.xml_simple_1_1_2;
|
||||
yajl_ruby = g.yajl_ruby_1_2_1;
|
||||
};
|
||||
gem_nix_args = [ ''autotest-rails'' ''aws-sdk'' ''bitbucket-backup'' ''buildr'' ''compass'' ''cucumber'' ''erubis'' ''execjs'' ''fakes3'' ''foreman'' ''gettext'' ''heroku'' ''iconv'' ''jekyll'' ''jsduck'' ''lockfile'' ''mechanize'' ''newrelic_plugin'' ''nix'' ''papertrail-cli'' ''rabbitmq_manager-0.1.0'' ''rails'' ''rake'' ''rb-fsevent'' ''rdoc'' ''redis'' ''remote_syslog'' ''riemann-dash'' ''right_aws'' ''rmail'' ''sass'' ''selenium-webdriver'' ''sinatra-1.3.2'' ''taskjuggler'' ''terminal-notifier'' ''thin'' ''tmuxinator'' ''travis'' ''trollop'' ''uglifier'' ''uuid'' ''xapian-full'' ''xapian-ruby'' ''yajl-ruby'' ];
|
||||
gem_nix_args = [ ''autotest-rails'' ''aws-sdk'' ''bitbucket-backup'' ''buildr'' ''compass'' ''cucumber'' ''erubis'' ''execjs'' ''fakes3'' ''foreman'' ''gettext'' ''heroku'' ''iconv'' ''jekyll'' ''jsduck'' ''kitchen-ansible'' ''kitchen-vagrant'' ''lockfile'' ''mechanize'' ''newrelic_plugin'' ''nix'' ''papertrail-cli'' ''rabbitmq_manager-0.1.0'' ''rails'' ''rake'' ''rb-fsevent'' ''rdoc'' ''redis'' ''remote_syslog'' ''riemann-dash'' ''right_aws'' ''rmail'' ''sass'' ''selenium-webdriver'' ''sinatra-1.3.2'' ''taskjuggler'' ''terminal-notifier'' ''test-kitchen'' ''thin'' ''tmuxinator'' ''travis'' ''trollop'' ''uglifier'' ''uuid'' ''xapian-full'' ''xapian-ruby'' ''yajl-ruby'' ];
|
||||
gems = {
|
||||
ZenTest_4_11_0 = {
|
||||
basename = ''ZenTest'';
|
||||
@@ -1113,6 +1118,36 @@ For extra goodness, see: http://seattlerb.rubyforge.org/hoe/Hoe.pdf'';
|
||||
requiredGems = [ ];
|
||||
sha256 = ''0kkn5zhiffav2cffj43wwvzj07825r4j463ilfjgik034vnbjs83'';
|
||||
};
|
||||
kitchen_ansible_0_0_4 = {
|
||||
basename = ''kitchen_ansible'';
|
||||
meta = {
|
||||
description = ''ansible provisioner for test-kitchen'';
|
||||
homepage = ''https://github.com/neillturner/kitchen-ansible'';
|
||||
longDescription = ''== DESCRIPTION:
|
||||
|
||||
Ansible Provisioner for Test Kitchen
|
||||
|
||||
== FEATURES:
|
||||
|
||||
Supports running ansible-playbook
|
||||
|
||||
'';
|
||||
};
|
||||
name = ''kitchen-ansible-0.0.4'';
|
||||
requiredGems = [ ];
|
||||
sha256 = ''0wwp7yq2n1jjisy00yiahzpxjdjvk40ry0m9a1rzd56fr9yvck2y'';
|
||||
};
|
||||
kitchen_vagrant_0_15_0 = {
|
||||
basename = ''kitchen_vagrant'';
|
||||
meta = {
|
||||
description = ''Kitchen::Driver::Vagrant - A Vagrant Driver for Test Kitchen.'';
|
||||
homepage = ''https://github.com/test-kitchen/kitchen-vagrant/'';
|
||||
longDescription = ''Kitchen::Driver::Vagrant - A Vagrant Driver for Test Kitchen.'';
|
||||
};
|
||||
name = ''kitchen-vagrant-0.15.0'';
|
||||
requiredGems = [ g.test_kitchen_1_2_1 ];
|
||||
sha256 = ''1blf6qr0j9ab9ajrkb9fx67wnns3hgi9gda2l83hd3zfrjp6vc9w'';
|
||||
};
|
||||
kramdown_1_5_0 = {
|
||||
basename = ''kramdown'';
|
||||
meta = {
|
||||
@@ -1382,6 +1417,17 @@ extract-method refactorings still apply.'';
|
||||
requiredGems = [ ];
|
||||
sha256 = ''1kzq25l8fh2ngshlwy7k535ncb15n2piqmha86272frh71vw0xq2'';
|
||||
};
|
||||
mixlib_shellout_1_6_1 = {
|
||||
basename = ''mixlib_shellout'';
|
||||
meta = {
|
||||
description = ''Run external commands on Unix or Windows'';
|
||||
homepage = ''http://wiki.opscode.com/'';
|
||||
longDescription = ''Run external commands on Unix or Windows'';
|
||||
};
|
||||
name = ''mixlib-shellout-1.6.1'';
|
||||
requiredGems = [ ];
|
||||
sha256 = ''0awwll2gbsvsz7g6j473f0xrjzyxq755vl260lmki6p937d33f7a'';
|
||||
};
|
||||
multi_json_1_10_1 = {
|
||||
basename = ''multi_json'';
|
||||
meta = {
|
||||
@@ -1476,6 +1522,17 @@ The server will respond in-order.'';
|
||||
requiredGems = [ ];
|
||||
sha256 = ''0bxjy33yhxwsbnld8xj3zv64ibgfjn9rjpiqkyd5ipmz50pww8v9'';
|
||||
};
|
||||
net_scp_1_2_1 = {
|
||||
basename = ''net_scp'';
|
||||
meta = {
|
||||
description = ''A pure Ruby implementation of the SCP client protocol'';
|
||||
homepage = ''https://github.com/net-ssh/net-scp'';
|
||||
longDescription = ''A pure Ruby implementation of the SCP client protocol'';
|
||||
};
|
||||
name = ''net-scp-1.2.1'';
|
||||
requiredGems = [ g.net_ssh_2_9_1 ];
|
||||
sha256 = ''0b0jqrcsp4bbi4n4mzyf70cp2ysyp6x07j8k8cqgxnvb4i3a134j'';
|
||||
};
|
||||
net_sftp_2_1_2 = {
|
||||
basename = ''net_sftp'';
|
||||
meta = {
|
||||
@@ -2265,6 +2322,17 @@ management.
|
||||
requiredGems = [ ];
|
||||
sha256 = ''0v0bqpmnyivn0dqqkbzq0xcmas2l1msbwlpp2iclkninkmcqg9sf'';
|
||||
};
|
||||
test_kitchen_1_2_1 = {
|
||||
basename = ''test_kitchen'';
|
||||
meta = {
|
||||
description = ''Test Kitchen is an integration tool for developing and testing infrastructure code and software on isolated target platforms.'';
|
||||
homepage = ''http://kitchen.ci'';
|
||||
longDescription = ''Test Kitchen is an integration tool for developing and testing infrastructure code and software on isolated target platforms.'';
|
||||
};
|
||||
name = ''test-kitchen-1.2.1'';
|
||||
requiredGems = [ g.mixlib_shellout_1_6_1 g.net_scp_1_2_1 g.net_ssh_2_9_1 g.safe_yaml_1_0_4 g.thor_0_19_1 ];
|
||||
sha256 = ''1pmjzvmcvlfhk6l8p665dvx7qw6kypcbhwshkq999wjhbwmjq1nk'';
|
||||
};
|
||||
text_1_3_0 = {
|
||||
basename = ''text'';
|
||||
meta = {
|
||||
|
||||
@@ -18,6 +18,21 @@ Bundler.module_eval do
|
||||
end
|
||||
end
|
||||
|
||||
# swap out ENV
|
||||
def nix_with_env(env, &block)
|
||||
if env
|
||||
begin
|
||||
old_env = ENV.to_h
|
||||
ENV.replace(env)
|
||||
block.call
|
||||
ensure
|
||||
ENV.replace old_env
|
||||
end
|
||||
else
|
||||
block.call
|
||||
end
|
||||
end
|
||||
|
||||
# map a git uri to a fetchgit store path.
|
||||
def nix_git(uri)
|
||||
Pathname.new(nix_gem_sources["git"][uri])
|
||||
@@ -77,7 +92,7 @@ Bundler::Source::Rubygems.class_eval do
|
||||
]
|
||||
end
|
||||
|
||||
# Look-up gems that were originally from Rubygems.
|
||||
# Look-up gems that were originally from RubyGems.
|
||||
def remote_specs
|
||||
@remote_specs ||=
|
||||
begin
|
||||
@@ -96,6 +111,35 @@ Bundler::Source::Rubygems.class_eval do
|
||||
end
|
||||
|
||||
Bundler::Installer.class_eval do
|
||||
|
||||
# WHY:
|
||||
# This allows us to provide a typical Nix experience, where
|
||||
# `buildInputs` and/or `preInstall` may set up the $PATH and other env-vars
|
||||
# as needed. By swapping out the environment per install, we can have finer
|
||||
# grained control than we would have otherwise.
|
||||
#
|
||||
# HOW:
|
||||
# This is a wrapper around the original `install_gem_from_spec`.
|
||||
# We expect that a "pre-installer" might exist at `pre-installers/<gem-name>`,
|
||||
# and if it does, we execute it.
|
||||
# The pre-installer is expected to dump its environment variables as a Ruby
|
||||
# hash to `env/<gem-name>`.
|
||||
# We then swap out the environment for the duration of the install,
|
||||
# and then set it back to what it was originally.
|
||||
alias original_install_gem_from_spec install_gem_from_spec
|
||||
def install_gem_from_spec(spec, standalone = false, worker = 0)
|
||||
pre_installer = "pre-installers/#{spec.name}"
|
||||
if File.exist?(pre_installer)
|
||||
system(pre_installer)
|
||||
env = eval(Bundler.read_file("env/#{spec.name}"))
|
||||
Bundler.nix_with_env(env) do
|
||||
original_install_gem_from_spec(spec, standalone, worker)
|
||||
end
|
||||
else
|
||||
original_install_gem_from_spec(spec, standalone, worker)
|
||||
end
|
||||
end
|
||||
|
||||
def generate_bundler_executable_stubs(spec, options = {})
|
||||
return if spec.executables.empty?
|
||||
|
||||
@@ -119,7 +163,7 @@ ENV["BUNDLE_GEMFILE"] =
|
||||
ENV["GEM_HOME"] =
|
||||
"#{ENV["GEM_HOME"]}"
|
||||
ENV["GEM_PATH"] =
|
||||
"#{ENV["NIX_BUNDLER_GEMPATH"]}:#{ENV["GEM_HOME"]}\#{old_gem_path ? ":\#{old_gem_path}" : ""}}"
|
||||
"#{ENV["NIX_BUNDLER_GEMPATH"]}:\#{ENV["GEM_HOME"]}\#{old_gem_path ? ":\#{old_gem_path}" : ""}}"
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
@@ -171,7 +215,7 @@ ENV["BUNDLE_GEMFILE"] =
|
||||
ENV["GEM_HOME"] =
|
||||
"#{ENV["GEM_HOME"]}"
|
||||
ENV["GEM_PATH"] =
|
||||
"#{ENV["NIX_BUNDLER_GEMPATH"]}:#{ENV["GEM_HOME"]}\#{old_gem_path ? ":\#{old_gem_path}" : ""}}"
|
||||
"#{ENV["NIX_BUNDLER_GEMPATH"]}:\#{ENV["GEM_HOME"]}\#{old_gem_path ? ":\#{old_gem_path}" : ""}}"
|
||||
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
{ stdenv, fetchurl, fetchgit, fetchFromGitHub
|
||||
, zlib, zlibSupport ? true
|
||||
, openssl, opensslSupport ? true
|
||||
, gdbm, gdbmSupport ? true
|
||||
, ncurses, readline, cursesSupport ? false
|
||||
, groff, docSupport ? false
|
||||
, libyaml, yamlSupport ? true
|
||||
, libffi, fiddleSupport ? true
|
||||
, ruby_2_2_0, autoreconfHook, bison, useRailsExpress ? true
|
||||
}:
|
||||
|
||||
let
|
||||
op = stdenv.lib.optional;
|
||||
ops = stdenv.lib.optionals;
|
||||
patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
|
||||
config = import ./config.nix fetchgit;
|
||||
baseruby = ruby_2_2_0.override { useRailsExpress = false; };
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
|
||||
|
||||
name = "ruby-${version}";
|
||||
|
||||
src = if useRailsExpress then fetchFromGitHub {
|
||||
owner = "ruby";
|
||||
repo = "ruby";
|
||||
rev = "v2_2_0";
|
||||
sha256 = "1w7rr2nq1bbw6aiagddzlrr3rl95kk33x4pv6570nm072g55ybpi";
|
||||
} else fetchurl {
|
||||
url = "http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.gz";
|
||||
sha256 = "1z2092fbpc2qkv1j3yj7jdz7qwvqpxqpmcnkphpjcpgvmfaf6wbn";
|
||||
};
|
||||
|
||||
# Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
|
||||
NROFF = "${groff}/bin/nroff";
|
||||
|
||||
buildInputs = ops useRailsExpress [ autoreconfHook bison ]
|
||||
++ (op fiddleSupport libffi)
|
||||
++ (ops cursesSupport [ ncurses readline ])
|
||||
++ (op docSupport groff)
|
||||
++ (op zlibSupport zlib)
|
||||
++ (op opensslSupport openssl)
|
||||
++ (op gdbmSupport gdbm)
|
||||
++ (op yamlSupport libyaml)
|
||||
# Looks like ruby fails to build on darwin without readline even if curses
|
||||
# support is not enabled, so add readline to the build inputs if curses
|
||||
# support is disabled (if it's enabled, we already have it) and we're
|
||||
# running on darwin
|
||||
++ (op (!cursesSupport && stdenv.isDarwin) readline);
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
patches = ops useRailsExpress [
|
||||
"${patchSet}/patches/ruby/2.2.0/railsexpress/01-zero-broken-tests.patch"
|
||||
"${patchSet}/patches/ruby/2.2.0/railsexpress/02-improve-gc-stats.patch"
|
||||
"${patchSet}/patches/ruby/2.2.0/railsexpress/03-display-more-detailed-stack-trace.patch"
|
||||
"${patchSet}/patches/ruby/2.2.0/railsexpress/04-backport-401c8bb.patch"
|
||||
"${patchSet}/patches/ruby/2.2.0/railsexpress/05-fix-packed-bitfield-compat-warning-for-older-gccs.patch"
|
||||
];
|
||||
|
||||
# Ruby >= 2.1.0 tries to download config.{guess,sub}
|
||||
postPatch = ''
|
||||
rm tool/config_files.rb
|
||||
cp ${config}/config.guess tool/
|
||||
cp ${config}/config.sub tool/
|
||||
'';
|
||||
|
||||
configureFlags = ["--enable-shared" ]
|
||||
++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
|
||||
# on darwin, we have /usr/include/tk.h -- so the configure script detects
|
||||
# that tk is installed
|
||||
++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
|
||||
|
||||
installFlags = stdenv.lib.optionalString docSupport "install-doc";
|
||||
# Bundler tries to create this directory
|
||||
postInstall = ''
|
||||
# Bundler tries to create this directory
|
||||
mkdir -pv $out/${passthru.gemPath}
|
||||
mkdir -p $out/nix-support
|
||||
cat > $out/nix-support/setup-hook <<EOF
|
||||
addGemPath() {
|
||||
addToSearchPath GEM_PATH \$1/${passthru.gemPath}
|
||||
}
|
||||
|
||||
envHooks+=(addGemPath)
|
||||
EOF
|
||||
'';
|
||||
|
||||
meta = {
|
||||
license = stdenv.lib.licenses.ruby;
|
||||
homepage = "http://www.ruby-lang.org/en/";
|
||||
description = "The Ruby language";
|
||||
platforms = stdenv.lib.platforms.all;
|
||||
};
|
||||
|
||||
passthru = rec {
|
||||
majorVersion = "2";
|
||||
minorVersion = "2";
|
||||
teenyVersion = "0";
|
||||
patchLevel = "0";
|
||||
libPath = "lib/ruby/${majorVersion}.${minorVersion}";
|
||||
gemPath = "lib/ruby/gems/${majorVersion}.${minorVersion}";
|
||||
};
|
||||
}
|
||||
@@ -3,6 +3,6 @@
|
||||
fetchFromGitHub {
|
||||
owner = "skaes";
|
||||
repo = "rvm-patchsets";
|
||||
rev = "fb6b427f71e756900184d1b6eaeb10245ec8405a";
|
||||
sha256 = "10k7p3nymj7y5a0az8v1aks2w5w190zfqv9kiiafcx0a3qfswnck";
|
||||
rev = "da2e5b4d81e18154befef1448e037b844cb5a326";
|
||||
sha256 = "0fslnkpirgsm7gjd6g194vd24i3y7kl0ihbq5gr94cgvdzzjgad0";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user