consule: use new bundlerEnv
This commit is contained in:
parent
f52c32fcfc
commit
317d78d145
10 changed files with 191 additions and 81 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <<EOF
|
||||
export DYLD_INSERT_LIBRARIES="$DYLD_INSERT_LIBRARIES''${!DYLD_INSERT_LIBRARIES:+:}${v8}/lib/libv8.dylib"
|
||||
EOF
|
||||
'';
|
||||
#postInstall = ''
|
||||
#'';
|
||||
|
||||
buildFlags = [
|
||||
"--with-v8-dir=${v8}" "--with-v8-include=${v8}/include"
|
||||
"--with-v8-dir=${v8}"
|
||||
"--with-v8-include=${v8}/include"
|
||||
"--with-v8-lib=${v8}/lib"
|
||||
];
|
||||
};
|
||||
|
||||
xapian-ruby = attrs: {
|
||||
# use the system xapian
|
||||
buildInputs = [ xapian pkgconfig zlib ];
|
||||
postPatch = ''
|
||||
cp ${./xapian-Rakefile} Rakefile
|
||||
'';
|
||||
preInstall = ''
|
||||
export XAPIAN_CONFIG=${xapian}/bin/xapian-config
|
||||
'';
|
||||
};
|
||||
}
|
84
pkgs/development/interpreters/ruby/bundler-env/location.rb
Normal file
84
pkgs/development/interpreters/ruby/bundler-env/location.rb
Normal file
|
@ -0,0 +1,84 @@
|
|||
# See: https://github.com/cowboyd/libv8/pull/161
|
||||
|
||||
require 'yaml'
|
||||
require 'pathname'
|
||||
require File.expand_path '../paths', __FILE__
|
||||
|
||||
module Libv8
|
||||
class Location
|
||||
def install!
|
||||
File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f|
|
||||
f.write self.to_yaml
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def self.load!
|
||||
File.open(Pathname(__FILE__).dirname.join('.location.yml')) do |f|
|
||||
YAML.load f
|
||||
end
|
||||
end
|
||||
|
||||
class Vendor < Location
|
||||
def install!
|
||||
require File.expand_path '../builder', __FILE__
|
||||
builder = Libv8::Builder.new
|
||||
exit_status = builder.build_libv8!
|
||||
super if exit_status == 0
|
||||
verify_installation!
|
||||
return exit_status
|
||||
end
|
||||
def configure(context = MkmfContext.new)
|
||||
context.incflags.insert 0, Libv8::Paths.include_paths.map{|p| "-I#{p}"}.join(" ") + " "
|
||||
context.ldflags.insert 0, Libv8::Paths.object_paths.join(" ") + " "
|
||||
end
|
||||
|
||||
def verify_installation!
|
||||
Libv8::Paths.object_paths.each do |p|
|
||||
fail ArchiveNotFound, p unless File.exist? p
|
||||
end
|
||||
end
|
||||
|
||||
class ArchiveNotFound < StandardError
|
||||
def initialize(filename)
|
||||
super "libv8 did not install properly, expected binary v8 archive '#{filename}'to exist, but it was not found"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class System < Location
|
||||
def configure(context = MkmfContext.new)
|
||||
context.send(:dir_config, 'v8')
|
||||
context.send(:find_header, 'v8.h') or fail NotFoundError
|
||||
context.send(:have_library, 'v8') or fail NotFoundError
|
||||
end
|
||||
|
||||
class NotFoundError < StandardError
|
||||
def initialize(*args)
|
||||
super(<<-EOS)
|
||||
You have chosen to use the version of V8 found on your system
|
||||
and *not* the one that is bundle with the libv8 rubygem. However,
|
||||
it could not be located. please make sure you have a version of
|
||||
v8 that is compatible with #{Libv8::VERSION} installed. You may
|
||||
need to special --with-v8-dir options if it is in a non-standard
|
||||
location
|
||||
|
||||
thanks,
|
||||
The Mgmt
|
||||
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class MkmfContext
|
||||
def incflags
|
||||
$INCFLAGS
|
||||
end
|
||||
|
||||
def ldflags
|
||||
$LDFLAGS
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, fetchurl, gyp, readline, python, which, icu }:
|
||||
{ stdenv, lib, fetchurl, gyp, readline, python, which, icu, utillinux}:
|
||||
|
||||
assert readline != null;
|
||||
|
||||
|
@ -35,9 +35,12 @@ stdenv.mkDerivation rec {
|
|||
'';
|
||||
|
||||
nativeBuildInputs = [ which ];
|
||||
buildInputs = [ readline python icu ];
|
||||
buildInputs = [ readline python icu ] ++ lib.optional stdenv.isLinux utillinux;
|
||||
|
||||
NIX_CFLAGS_COMPILE = "-Wno-error";
|
||||
|
||||
buildFlags = [
|
||||
#"LINK=g++"
|
||||
"-C out"
|
||||
"builddir=$(CURDIR)/Release"
|
||||
"BUILDTYPE=Release"
|
||||
|
@ -48,9 +51,9 @@ stdenv.mkDerivation rec {
|
|||
installPhase = ''
|
||||
install -vD out/Release/d8 "$out/bin/d8"
|
||||
${if stdenv.system == "x86_64-darwin" then ''
|
||||
install -vD out/Release/libv8.dylib "$out/lib/libv8.dylib"
|
||||
install -vD out/Release/lib.target/libv8.dylib "$out/lib/libv8.dylib"
|
||||
'' else ''
|
||||
install -vD out/Release/libv8.so "$out/lib/libv8.so"
|
||||
install -vD out/Release/lib.target/libv8.so "$out/lib/libv8.so"
|
||||
''}
|
||||
cp -vr include "$out/"
|
||||
'';
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
{ stdenv, lib, go, fetchgit, fetchhg, fetchbzr, fetchFromGitHub
|
||||
, ruby, nodejs, loadRubyEnv }:
|
||||
{ stdenv, lib, go, fetchgit, fetchhg, fetchbzr, fetchFromGitHub , ruby , nodejs
|
||||
, bundlerEnv }:
|
||||
|
||||
let
|
||||
version = "0.4.1";
|
||||
rubyEnv = loadRubyEnv { gemset = ./gemset.nix; };
|
||||
# `sass` et al
|
||||
gems = bundlerEnv {
|
||||
name = "consul-deps";
|
||||
gemfile = ./Gemfile;
|
||||
lockfile = ./Gemfile.lock;
|
||||
gemset = ./gemset.nix;
|
||||
};
|
||||
in
|
||||
|
||||
with lib;
|
||||
|
@ -14,7 +20,7 @@ stdenv.mkDerivation {
|
|||
inherit stdenv lib fetchgit fetchhg fetchbzr fetchFromGitHub;
|
||||
};
|
||||
|
||||
buildInputs = [ go ruby rubyEnv.sass rubyEnv.uglifier nodejs ];
|
||||
buildInputs = [ go ruby gems nodejs ];
|
||||
|
||||
buildPhase = ''
|
||||
# Build consul binary
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
{
|
||||
execjs = {
|
||||
version = "2.0.2";
|
||||
src = {
|
||||
source = {
|
||||
type = "gem";
|
||||
sha256 = "167kbkyql7nvvwjsgdw5z8j66ngq7kc59gxfwsxhqi5fl1z0jbjs";
|
||||
};
|
||||
};
|
||||
json = {
|
||||
version = "1.8.1";
|
||||
src = {
|
||||
source = {
|
||||
type = "gem";
|
||||
sha256 = "0002bsycvizvkmk1jyv8px1hskk6wrjfk4f7x5byi8gxm6zzn6wn";
|
||||
};
|
||||
};
|
||||
libv8 = {
|
||||
version = "3.16.14.3";
|
||||
src = {
|
||||
source = {
|
||||
type = "gem";
|
||||
sha256 = "1arjjbmr9zxkyv6pdrihsz1p5cadzmx8308vgfvrhm380ccgridm";
|
||||
};
|
||||
};
|
||||
ref = {
|
||||
version = "1.0.5";
|
||||
src = {
|
||||
source = {
|
||||
type = "gem";
|
||||
sha256 = "19qgpsfszwc2sfh6wixgky5agn831qq8ap854i1jqqhy1zsci3la";
|
||||
};
|
||||
};
|
||||
sass = {
|
||||
version = "3.3.6";
|
||||
src = {
|
||||
source = {
|
||||
type = "gem";
|
||||
sha256 = "0ra0kxx52cgyrq6db7a1vysk984ilshbx40bcf527k8b3fha6k5r";
|
||||
};
|
||||
};
|
||||
therubyracer = {
|
||||
version = "0.12.1";
|
||||
src = {
|
||||
source = {
|
||||
type = "gem";
|
||||
sha256 = "106fqimqyaalh7p6czbl5m2j69z8gv7cm10mjb8bbb2p2vlmqmi6";
|
||||
};
|
||||
|
@ -47,7 +47,7 @@
|
|||
};
|
||||
uglifier = {
|
||||
version = "2.5.0";
|
||||
src = {
|
||||
source = {
|
||||
type = "gem";
|
||||
sha256 = "0b9kxgyg8cv3g1bp6casndfzfy71jd9xyjxwng0lj90vzqrgjp20";
|
||||
};
|
||||
|
@ -56,4 +56,4 @@
|
|||
"json"
|
||||
];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -680,7 +680,7 @@ let
|
|||
cloud-init = callPackage ../tools/virtualization/cloud-init { };
|
||||
|
||||
consul = callPackage ../servers/consul {
|
||||
inherit ruby rubyPackages;
|
||||
# inherit ruby;
|
||||
};
|
||||
|
||||
consul_ui = consul.ui;
|
||||
|
@ -4304,7 +4304,7 @@ let
|
|||
bundler_HEAD = import ../development/interpreters/ruby/bundler-head.nix {
|
||||
inherit buildRubyGem coreutils fetchgit;
|
||||
};
|
||||
gemFixes = callPackage ../development/interpreters/ruby/fixes.nix { };
|
||||
defaultGemConfig = callPackage ../development/interpreters/ruby/bundler-env/default-gem-config.nix { };
|
||||
buildRubyGem = callPackage ../development/interpreters/ruby/gem.nix { };
|
||||
loadRubyEnv = callPackage ../development/interpreters/ruby/load-ruby-env.nix { };
|
||||
bundlerEnv = callPackage ../development/interpreters/ruby/bundler-env.nix { };
|
||||
|
|
Loading…
Reference in a new issue