diff --git a/pkgs/development/interpreters/ruby/bundix.nix b/pkgs/development/interpreters/ruby/bundix.nix deleted file mode 100644 index 691b4c5e9799..000000000000 --- a/pkgs/development/interpreters/ruby/bundix.nix +++ /dev/null @@ -1,45 +0,0 @@ -{rubyLibsWith, callPackage, lib, fetchurl, fetchgit}: - -let - - sourceInstantiators = { - # Many ruby people use `git ls-files` to compose their gemspecs. - git = (attrs: fetchgit { inherit (attrs) url rev sha256 leaveDotGit; }); - url = (attrs: fetchurl { inherit (attrs) url sha256; }); - }; - -in - -{ - # Loads a set containing a ruby environment definition. The set's `gemset` - # key is expected to contain a set of gems. Optionally, the `ruby_version` - # key can be set to a string. A gem definition looks like this: - # - # rack-test = { - # name = "rack-test-0.6.2"; - # src = { - # type = "url"; - # url = "https://rubygems.org/downloads/rack-test-0.6.2.gem"; - # sha256 = "01mk715ab5qnqf6va8k3hjsvsmplrfqpz6g58qw4m3l8mim0p4ky"; - # }; - # dependencies = [ "rack" ]; - # }; - loadRubyEnv = path: config: - let - expr = import path; - gemset = lib.mapAttrs (name: attrs: - attrs // { - src = (builtins.getAttr attrs.src.type sourceInstantiators) attrs.src; - dontBuild = !(attrs.src.type == "git"); - } - ) expr.gemset; - ruby = config.ruby; - rubyLibs = rubyLibsWith ruby; - gems = rubyLibs.importGems gemset (config.gemOverrides or (gemset: {})); - in { - inherit ruby gems; # TODO: Set ruby using expr.rubyVersion if not given. - gemPath = map (drv: "${drv}") ( - builtins.filter (value: lib.isDerivation value) (lib.attrValues gems) - ); - }; -} diff --git a/pkgs/development/interpreters/ruby/fixes.nix b/pkgs/development/interpreters/ruby/fixes.nix index 7314bc2a0083..eebda22263ac 100644 --- a/pkgs/development/interpreters/ruby/fixes.nix +++ b/pkgs/development/interpreters/ruby/fixes.nix @@ -21,21 +21,20 @@ , which, postgresql, v8_3_16_14, clang }: let - id = x: x; + const = x: y: x; v8 = v8_3_16_14; - gems = lib.mapAttrs (name: config: - if (lib.isDerivation config) then config - else (instantiate name config) + gems = lib.mapAttrs (name: attrs: + if (lib.isDerivation attrs) then attrs + else (instantiate name attrs) ) gemset; instantiate = (name: attrs: let - # Turn dependency strings into actual derivations. gemPath = map (name: gems."${name}") (attrs.dependencies or []); - fixedAttrs = (fixes."${name}" or id) attrs; + fixedAttrs = attrs // (fixes."${name}" or const {}) attrs; in - buildRubyGem (fixedAttrs // { inherit gemPath; }) + buildRubyGem (fixedAttrs // { name = "${name}-${attrs.version}"; inherit gemPath; }) ); fixes = { diff --git a/pkgs/development/interpreters/ruby/gem.nix b/pkgs/development/interpreters/ruby/gem.nix index ce0b8e15fec2..b136cb0de9b2 100644 --- a/pkgs/development/interpreters/ruby/gem.nix +++ b/pkgs/development/interpreters/ruby/gem.nix @@ -1,13 +1,12 @@ { ruby, fetchurl, rake, rubygemsFun, makeWrapper, lib, git }: { name -, namePrefix ? "ruby${ruby.majorVersion}" + "-" +, namePrefix ? "${ruby.name}" + "-" , buildInputs ? [] , doCheck ? false # TODO: fix this , dontBuild ? true , meta ? {} , gemPath ? [] -, testTask ? "test" , ...} @ attrs: let @@ -60,7 +59,10 @@ in ruby.stdenv.mkDerivation (attrs // { gemspec=`find . -name '*.gemspec'` output=`gem build $gemspec` - gempkg=`echo $output|grep -oP 'File: \K(.*)'` + + gem build $gemspec | tee .output + gempkg=`cat .output | grep -oP 'File: \K(.*)'` + rm .output echo "Gem package built: $gempkg" @@ -103,7 +105,7 @@ in ruby.stdenv.mkDerivation (attrs // { mkdir -p $out/nix-support cat > $out/nix-support/setup-hook <