1 { ruby, lib, callPackage, defaultGemConfig, buildEnv, runCommand
12 , groups ? ["default"]
14 , copyGemFiles ? false # Copy gem files instead of symlinking
15 , gemConfig ? defaultGemConfig
19 , ignoreCollisions ? false
25 inherit (import ../bundled-common/functions.nix { inherit lib ruby gemConfig groups; }) genStubsScript;
27 basicEnv = (callPackage ../bundled-common { inherit bundler; }) (args // { inherit pname name; mainGemName = pname; });
29 inherit (basicEnv) envPaths;
30 # Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" -
31 # either specific executables or the bin/ for certain gem(s), but
32 # incorporates the basicEnv as a requirement so that its $out is in our path.
34 # When stubbing the bins for a gem, we should use the gem expression
35 # directly, which means that basicEnv should somehow make it available.
37 # Different use cases should use different variations on this file, rather
38 # than the expression trying to deduce a use case.
40 # The basicEnv should be put into passthru so that e.g. nix-shell can use it.
43 basicEnv // { inherit name basicEnv; }
47 inherit ignoreCollisions;
52 pathsToLink = [ "/lib" ];
54 postBuild = genStubsScript {
55 inherit lib runCommand ruby bundler groups;
56 confFiles = basicEnv.confFiles;
57 binPaths = [ basicEnv.gems.${pname} ];
58 } + lib.optionalString (postBuild != null) postBuild;
60 meta = { platforms = ruby.meta.platforms; } // meta;
61 passthru = basicEnv.passthru // {
63 inherit (basicEnv) env;
68 runCommand basicEnv.name bundlerEnvArgs ''
71 ${buildPackages.rsync}/bin/rsync -a $i/lib $out/
76 buildEnv bundlerEnvArgs