summary refs log tree commit diff
path: root/pkgs/development/ruby-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ruby-modules')
-rw-r--r--pkgs/development/ruby-modules/bundled-common/default.nix3
-rw-r--r--pkgs/development/ruby-modules/bundler-app/default.nix39
-rw-r--r--pkgs/development/ruby-modules/gem/default.nix9
3 files changed, 37 insertions, 14 deletions
diff --git a/pkgs/development/ruby-modules/bundled-common/default.nix b/pkgs/development/ruby-modules/bundled-common/default.nix
index f902ca58c384..415457b86e16 100644
--- a/pkgs/development/ruby-modules/bundled-common/default.nix
+++ b/pkgs/development/ruby-modules/bundled-common/default.nix
@@ -19,6 +19,7 @@
 , meta ? {}
 , groups ? ["default"]
 , ignoreCollisions ? false
+, buildInputs ? []
 , ...
 }@args:
 
@@ -96,7 +97,7 @@ let
   envPaths = lib.attrValues gems ++ lib.optional (!hasBundler) bundler;
 
   basicEnv = buildEnv {
-    inherit  ignoreCollisions;
+    inherit buildInputs ignoreCollisions;
 
     name = name';
 
diff --git a/pkgs/development/ruby-modules/bundler-app/default.nix b/pkgs/development/ruby-modules/bundler-app/default.nix
index c8f61389ad3f..60e3a38517ce 100644
--- a/pkgs/development/ruby-modules/bundler-app/default.nix
+++ b/pkgs/development/ruby-modules/bundler-app/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, callPackage, runCommand, ruby }@defs:
+{ lib, stdenv, callPackage, runCommand, makeWrapper, ruby }@defs:
 
 # Use for simple installation of Ruby tools shipped in a Gem.
 # Start with a Gemfile that includes `gem <toolgem>`
@@ -24,7 +24,9 @@
 , gemset ? null
 , preferLocalBuild ? false
 , allowSubstitutes ? false
+, installManpages ? true
 , meta ? {}
+, buildInputs ? []
 , postBuild ? ""
 , gemConfig ? null
 }@args:
@@ -32,18 +34,29 @@
 let
   basicEnv = (callPackage ../bundled-common {}) args;
 
-  cmdArgs = removeAttrs args [ "pname" "postBuild" "gemConfig" ]
-  // { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
+  cmdArgs = removeAttrs args [ "pname" "postBuild" "gemConfig" ] // {
+    inherit preferLocalBuild allowSubstitutes; # pass the defaults
+
+    buildInputs = buildInputs ++ lib.optional (scripts != []) makeWrapper;
+  };
 in
-   runCommand basicEnv.name cmdArgs ''
-    mkdir -p $out/bin;
-      ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' $out/bin/${x};\n") exes)}
-      ${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " +
-              "--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+
-              "--set BUNDLE_PATH ${basicEnv}/${ruby.gemPath} "+
-              "--set BUNDLE_FROZEN 1 "+
-              "--set GEM_HOME ${basicEnv}/${ruby.gemPath} "+
-              "--set GEM_PATH ${basicEnv}/${ruby.gemPath} "+
-              "--run \"cd $srcdir\";\n") scripts)}
+  runCommand basicEnv.name cmdArgs ''
+    mkdir -p $out/bin
+    ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' $out/bin/${x};\n") exes)}
+    ${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " +
+                                "--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+
+                                "--set BUNDLE_PATH ${basicEnv}/${ruby.gemPath} "+
+                                "--set BUNDLE_FROZEN 1 "+
+                                "--set GEM_HOME ${basicEnv}/${ruby.gemPath} "+
+                                "--set GEM_PATH ${basicEnv}/${ruby.gemPath} "+
+                                "--run \"cd $srcdir\";\n") scripts)}
+
+    ${lib.optionalString installManpages ''
+    for section in {1..9}; do
+      mandir="$out/share/man/man$section"
+      find -L ${basicEnv}/${ruby.gemPath}/gems/${basicEnv.name} \( -wholename "*/man/*.$section" -o -wholename "*/man/man$section/*.$section" \) -print -execdir mkdir -p $mandir \; -execdir cp '{}' $mandir \;
+    done
+    ''}
+
     ${postBuild}
   ''
diff --git a/pkgs/development/ruby-modules/gem/default.nix b/pkgs/development/ruby-modules/gem/default.nix
index d00ce7fccf5c..b0abb2c54fc5 100644
--- a/pkgs/development/ruby-modules/gem/default.nix
+++ b/pkgs/development/ruby-modules/gem/default.nix
@@ -44,6 +44,7 @@ lib.makeOverridable (
 # git checkout).
 # If you need to apply patches, make sure to set `dontBuild = false`;
 , dontBuild ? true
+, dontInstallManpages ? false
 , propagatedBuildInputs ? []
 , propagatedUserEnvPkgs ? []
 , buildFlags ? []
@@ -206,6 +207,14 @@ stdenv.mkDerivation ((builtins.removeAttrs attrs ["source"]) // {
     ruby ${./gem-post-build.rb} "$spec"
     ''}
 
+    ${lib.optionalString (!dontInstallManpages) ''
+    for section in {1..9}; do
+      mandir="$out/share/man/man$section"
+      find $out/lib \( -wholename "*/man/*.$section" -o -wholename "*/man/man$section/*.$section" \) \
+        -execdir mkdir -p $mandir \; -execdir cp '{}' $mandir \;
+    done
+    ''}
+
     runHook postInstall
   '';