mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
Make it possible to override system ruby gems
svn path=/nixpkgs/trunk/; revision=25658
This commit is contained in:
parent
e76aee9d2f
commit
08a1b61716
@ -1,4 +1,4 @@
|
||||
{stdenv, fetchurl, ruby, rubygems, makeWrapper, patches, overwrites}:
|
||||
{stdenv, fetchurl, ruby, rubygems, makeWrapper, patches, overrides}:
|
||||
|
||||
let
|
||||
gemDefaults = { name, basename, requiredGems, sha256, meta }:
|
||||
@ -42,10 +42,11 @@ let
|
||||
'';
|
||||
};
|
||||
mb = stdenv.lib.maybeAttr;
|
||||
patchedGem = a: stdenv.mkDerivation (removeAttrs (stdenv.lib.mergeAttrsByFuncDefaults
|
||||
([ (gemDefaults a) ]
|
||||
++ (stdenv.lib.concatMap (p: [(mb a.basename {} p) (mb a.name {} p)] )
|
||||
patches)))
|
||||
[ "mergeAttrBy" ]);
|
||||
in
|
||||
aName: a@{ name, basename, requiredGems, sha256, meta }:
|
||||
mb name (mb basename (
|
||||
stdenv.mkDerivation (removeAttrs (stdenv.lib.mergeAttrsByFuncDefaults
|
||||
[ (gemDefaults a) (mb name {} patches) (mb basename {} patches) ]
|
||||
) ["mergeAttrBy"])
|
||||
) overwrites) overwrites
|
||||
stdenv.lib.foldl (d: o: mb name (mb basename d o) o) (patchedGem a) overrides
|
||||
|
@ -1,12 +1,33 @@
|
||||
{stdenv, config, fetchurl, callPackage}:
|
||||
{stdenv, getConfig, fetchurl, callPackage}:
|
||||
|
||||
let
|
||||
generated = stdenv.lib.attrByPath [ "gems" "generated" ] (import ./generated.nix) config;
|
||||
auto = generated merged;
|
||||
patches = callPackage ./patches.nix { } gems;
|
||||
overwrites = callPackage ./overwrites.nix { } gems;
|
||||
merged = stdenv.lib.mapAttrs gem auto.gems;
|
||||
gem = callPackage ./gem.nix { inherit patches overwrites; };
|
||||
gems = merged // auto.aliases;
|
||||
inherit (stdenv.lib) fold optional;
|
||||
gemsMergeableFun = { generatedFuns ? [], patchFuns ? [], overrideFuns ? [] }:
|
||||
let
|
||||
generatedAttrs = map (f: f customGems) generatedFuns;
|
||||
generatedGems = map (a: a.gems) generatedAttrs;
|
||||
gem = callPackage ./gem.nix {
|
||||
patches = map (f: callPackage f { inherit gems; }) patchFuns;
|
||||
overrides = map (f: callPackage f { }) overrideFuns;
|
||||
};
|
||||
customGems = stdenv.lib.mapAttrs gem (fold (x: y: x // y) { } generatedGems);
|
||||
gems = fold (x: y: x // y) customGems (map (a: a.aliases) generatedAttrs);
|
||||
in
|
||||
gems // {
|
||||
merge = { generated ? null, patches ? null, overrides ? null }:
|
||||
gemsMergeableFun {
|
||||
generatedFuns = generatedFuns ++ optional (generated != null) generated;
|
||||
patchFuns = patchFuns ++ optional (patches != null) patches;
|
||||
overrideFuns = overrideFuns ++ optional (overrides != null) overrides;
|
||||
};
|
||||
};
|
||||
in
|
||||
gems
|
||||
((gemsMergeableFun { }).merge {
|
||||
generated = import ./generated.nix;
|
||||
patches = import ./patches.nix;
|
||||
overrides = import ./overrides.nix;
|
||||
}).merge {
|
||||
generated = getConfig [ "gems" "generated" ] null;
|
||||
patches = getConfig [ "gems" "patches" ] null;
|
||||
overrides = getConfig [ "gems" "overrides" ] null;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ xapianBindings }:
|
||||
gems:
|
||||
|
||||
{
|
||||
xapian_full = xapianBindings.merge { cfg = { rubySupport = true; }; };
|
@ -1,6 +1,5 @@
|
||||
{fetchurl, writeScript, ruby, ncurses, sqlite, libxml2, libxslt, libffi, zlib,
|
||||
libuuid}:
|
||||
gems:
|
||||
libuuid, gems}:
|
||||
|
||||
let
|
||||
patchUsrBinEnv = writeScript "path-usr-bin-env" ''
|
||||
|
Loading…
Reference in New Issue
Block a user