From 317d78d145393932042ff7f802655dd1a934a6f8 Mon Sep 17 00:00:00 2001 From: Charles Strahan Date: Wed, 21 Jan 2015 20:33:19 -0500 Subject: [PATCH] consule: use new bundlerEnv --- .../networking/mailreaders/sup/default.nix | 37 +------- .../interpreters/ruby/bundler-env.nix | 29 +++---- .../default-gem-config.nix} | 77 +++++++++++++---- .../interpreters/ruby/bundler-env/location.rb | 84 +++++++++++++++++++ .../ruby/bundler-env}/mkrf_conf_xapian.rb | 0 .../ruby/bundler-env}/xapian-Rakefile | 0 pkgs/development/libraries/v8/3.16.14.nix | 11 ++- pkgs/servers/consul/default.nix | 14 +++- pkgs/servers/consul/gemset.nix | 16 ++-- pkgs/top-level/all-packages.nix | 4 +- 10 files changed, 191 insertions(+), 81 deletions(-) rename pkgs/development/interpreters/ruby/{fixes.nix => bundler-env/default-gem-config.nix} (54%) create mode 100644 pkgs/development/interpreters/ruby/bundler-env/location.rb rename pkgs/{applications/networking/mailreaders/sup => development/interpreters/ruby/bundler-env}/mkrf_conf_xapian.rb (100%) rename pkgs/{applications/networking/mailreaders/sup => development/interpreters/ruby/bundler-env}/xapian-Rakefile (100%) diff --git a/pkgs/applications/networking/mailreaders/sup/default.nix b/pkgs/applications/networking/mailreaders/sup/default.nix index 874d662754f9..19715d7b255b 100644 --- a/pkgs/applications/networking/mailreaders/sup/default.nix +++ b/pkgs/applications/networking/mailreaders/sup/default.nix @@ -1,4 +1,5 @@ -{ stdenv, lib, bundlerEnv, gpgme, ruby, ncurses, writeText, zlib, xapian, pkgconfig, which }: +{ stdenv, lib, bundlerEnv, gpgme, ruby, ncurses, writeText, zlib, xapian +, pkgconfig, which }: bundlerEnv { name = "sup-0.20.0"; @@ -8,40 +9,6 @@ bundlerEnv { lockfile = ./Gemfile.lock; gemset = ./gemset.nix; - fixes.gpgme = attrs: { - buildInputs = [ gpgme ]; - }; - - fixes.ncursesw = attrs: { - buildInputs = [ ncurses ]; - buildArgs = [ - "--with-cflags=-I${ncurses}/include" - "--with-ldflags=-L${ncurses}/lib" - ]; - }; - - fixes.xapian-ruby = attrs: { - # use the system xapian - buildInputs = [ xapian pkgconfig zlib ]; - postPatch = '' - cp ${./xapian-Rakefile} Rakefile - ''; - preInstall = '' - export XAPIAN_CONFIG=${xapian}/bin/xapian-config - ''; - }; - - fixes.sup = attrs: { - # prevent sup from trying to dynamically install `xapian-ruby`. - postPatch = '' - cp ${./mkrf_conf_xapian.rb} ext/mkrf_conf_xapian.rb - - substituteInPlace lib/sup/crypto.rb \ - --replace 'which gpg2' \ - '${which}/bin/which gpg2' - ''; - }; - meta = with lib; { description = "A curses threads-with-tags style email client"; homepage = http://supmua.org; diff --git a/pkgs/development/interpreters/ruby/bundler-env.nix b/pkgs/development/interpreters/ruby/bundler-env.nix index 3ccc1b8ff917..352451c15033 100644 --- a/pkgs/development/interpreters/ruby/bundler-env.nix +++ b/pkgs/development/interpreters/ruby/bundler-env.nix @@ -1,13 +1,12 @@ { stdenv, runCommand, writeText, writeScript, writeScriptBin, ruby, lib -, callPackage , gemFixes, fetchurl, fetchgit, buildRubyGem -, bundler_HEAD +, callPackage, defaultGemConfig, fetchurl, fetchgit, buildRubyGem , bundler_HEAD , git }@defs: # This is a work-in-progress. # The idea is that his will replace load-ruby-env.nix. -{ name, gemset, gemfile, lockfile, ruby ? defs.ruby, fixes ? gemFixes +{ name, gemset, gemfile, lockfile, ruby ? defs.ruby, gemConfig ? defaultGemConfig , enableParallelBuilding ? false # TODO: this might not work, given the env-var shinanigans. , documentation ? false , meta ? {} @@ -37,9 +36,9 @@ let src = (fetchers."${attrs.source.type}" attrs); }; - applyFixes = attrs: - if fixes ? "${attrs.name}" - then attrs // fixes."${attrs.name}" attrs + applyGemConfigs = attrs: + if gemConfig ? "${attrs.name}" + then attrs // gemConfig."${attrs.name}" attrs else attrs; needsPatch = attrs: @@ -118,7 +117,7 @@ let }; instantiate = (attrs: - applyPatches (applyFixes (applySrc attrs)) + applyPatches (applyGemConfigs (applySrc attrs)) ); instantiated = lib.flip lib.mapAttrs (import gemset) (name: attrs: @@ -236,15 +235,15 @@ let end ''; - needsBuildArgs = attrs: attrs ? buildArgs; + needsBuildFlags = attrs: attrs ? buildFlags; - mkBuildArgs = spec: - "export BUNDLE_BUILD__${lib.toUpper spec.name}='${lib.concatStringsSep " " (map shellEscape spec.buildArgs)}'"; + mkBuildFlags = spec: + "export BUNDLE_BUILD__${lib.toUpper spec.name}='${lib.concatStringsSep " " (map shellEscape spec.buildFlags)}'"; - allBuildArgs = + allBuildFlags = lib.concatStringsSep "\n" - (map mkBuildArgs - (lib.filter needsBuildArgs (attrValues instantiated))); + (map mkBuildFlags + (lib.filter needsBuildFlags (attrValues instantiated))); in @@ -266,6 +265,8 @@ stdenv.mkDerivation { installPhase = '' # Copy the Gemfile and Gemfile.lock + #mkdir out + #out=$(pwd -P)/out mkdir -p $bundle export BUNDLE_GEMFILE=$bundle/Gemfile @@ -285,7 +286,7 @@ stdenv.mkDerivation { mkdir env ${runPreInstallers} - ${allBuildArgs} + ${allBuildFlags} ${lib.optionalString (!documentation) '' mkdir home diff --git a/pkgs/development/interpreters/ruby/fixes.nix b/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix similarity index 54% rename from pkgs/development/interpreters/ruby/fixes.nix rename to pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix index 0b8545090c51..b4ae465d37ec 100644 --- a/pkgs/development/interpreters/ruby/fixes.nix +++ b/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix @@ -18,7 +18,9 @@ # (to make gems behave if necessary). { lib, fetchurl, writeScript, ruby, libxml2, libxslt, python, stdenv, which -, libiconv, postgresql, v8_3_16_14, clang, sqlite, zlib, imagemagick, pkgconfig}: +, libiconv, postgresql, v8, v8_3_16_14, clang, sqlite, zlib, imagemagick, pkgconfig +, ncurses, xapian, gpgme, utillinux +}: let v8 = v8_3_16_14; @@ -30,9 +32,34 @@ in dontPatchShebangs = true; }; + gpgme = attrs: { + buildInputs = [ gpgme ]; + }; + libv8 = attrs: { - buildFlags = [ "--with-system-v8" ]; buildInputs = [ which v8 python ]; + # The "--with-system-v8" flag doesn't seem to work... + postPatch = '' + rm -r vendor + cp ${./location.rb} ext/libv8/location.rb + cat <<-EOF > ext/libv8/extconf.rb + require 'mkmf' + create_makefile('libv8') + + require File.expand_path '../location', __FILE__ + location = Libv8::Location::System.new + + exit location.install! + EOF + ''; + }; + + ncursesw = attrs: { + buildInputs = [ ncurses ]; + buildFlags = [ + "--with-cflags=-I${ncurses}/include" + "--with-ldflags=-L${ncurses}/lib" + ]; }; nokogiri = attrs: { @@ -66,24 +93,46 @@ in ]; }; + sup = attrs: { + # prevent sup from trying to dynamically install `xapian-ruby`. + postPatch = '' + cp ${./mkrf_conf_xapian.rb} ext/mkrf_conf_xapian.rb + + substituteInPlace lib/sup/crypto.rb \ + --replace 'which gpg2' \ + '${which}/bin/which gpg2' + ''; + }; + therubyracer = attrs: { - dontBuild = false; + #preInstall = '' + # ln -s ${clang}/bin/clang $TMPDIR/gcc + # ln -s ${clang}/bin/clang++ $TMPDIR/g++ + # export PATH=$TMPDIR:$PATH + #''; - preInstall = '' - ln -s ${clang}/bin/clang $TMPDIR/gcc - ln -s ${clang}/bin/clang++ $TMPDIR/g++ - export PATH=$TMPDIR:$PATH - ''; + #buildInputs = [ + # utillinux # for `flock` + #]; - postInstall = stdenv.lib.optionalString stdenv.isDarwin '' - cat >> $out/nix-support/setup-hook <