1{ ruby, lib, callPackage, defaultGemConfig, buildEnv, bundler }@defs:
2
3{ name ? null
4, pname ? null
5, gemdir ? null
6, gemfile ? null
7, lockfile ? null
8, gemset ? null
9, groups ? ["default"]
10, ruby ? defs.ruby
11, gemConfig ? defaultGemConfig
12, postBuild ? null
13, document ? []
14, meta ? {}
15, ignoreCollisions ? false
16, ...
17}@args:
18
19let
20 inherit (import ../bundled-common/functions.nix {inherit lib ruby gemConfig groups; }) genStubsScript;
21
22 basicEnv = (callPackage ../bundled-common {}) (args // { inherit pname name; mainGemName = pname; });
23
24 inherit (basicEnv) envPaths;
25 # Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" -
26 # either specific executables or the bin/ for certain gem(s), but
27 # incorporates the basicEnv as a requirement so that its $out is in our path.
28
29 # When stubbing the bins for a gem, we should use the gem expression
30 # directly, which means that basicEnv should somehow make it available.
31
32 # Different use cases should use different variations on this file, rather
33 # than the expression trying to deduce a use case.
34
35 # The basicEnv should be put into passthru so that e.g. nix-shell can use it.
36in
37 if pname == null then
38 basicEnv // { inherit name basicEnv; }
39 else
40 (buildEnv {
41 inherit ignoreCollisions;
42
43 name = basicEnv.name;
44
45 paths = envPaths;
46 pathsToLink = [ "/lib" ];
47
48 postBuild = genStubsScript {
49 inherit lib ruby bundler groups;
50 confFiles = basicEnv.confFiles;
51 binPaths = [ basicEnv.gems."${pname}" ];
52 } + lib.optionalString (postBuild != null) postBuild;
53
54 meta = { platforms = ruby.meta.platforms; } // meta;
55 passthru = basicEnv.passthru // {
56 inherit basicEnv;
57 inherit (basicEnv) env;
58 };
59 })