diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-05-06 00:38:52 +0200 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-05-07 17:08:08 +0000 |
commit | 6ffb5079b285a8db67856cb3ea43bfbb08310eb5 (patch) | |
tree | 35eafc3f0d97837910f3ec4dc1bd867e821704cc /pkgs/development/interpreters/ruby/default.nix | |
parent | 9b39be3376aa65a5fa21a65c3b776c7ef39b7b5c (diff) | |
download | nixpkgs-6ffb5079b285a8db67856cb3ea43bfbb08310eb5.tar nixpkgs-6ffb5079b285a8db67856cb3ea43bfbb08310eb5.tar.gz nixpkgs-6ffb5079b285a8db67856cb3ea43bfbb08310eb5.tar.bz2 nixpkgs-6ffb5079b285a8db67856cb3ea43bfbb08310eb5.tar.lz nixpkgs-6ffb5079b285a8db67856cb3ea43bfbb08310eb5.tar.xz nixpkgs-6ffb5079b285a8db67856cb3ea43bfbb08310eb5.tar.zst nixpkgs-6ffb5079b285a8db67856cb3ea43bfbb08310eb5.zip |
ruby: install ri docs to devdoc output
This allows getting access to Ruby documentation through ri by doing nix-shell -p ruby ruby.devdoc or by installing the ruby.devdoc package. A setup hook will add a shim to LOAD_PATH to point ri to the devdoc output instead of out.
Diffstat (limited to 'pkgs/development/interpreters/ruby/default.nix')
-rw-r--r-- | pkgs/development/interpreters/ruby/default.nix | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix index 8689927a2b1..cbc505ad802 100644 --- a/pkgs/development/interpreters/ruby/default.nix +++ b/pkgs/development/interpreters/ruby/default.nix @@ -61,6 +61,8 @@ let # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds. NROFF = if docSupport then "${groff}/bin/nroff" else null; + outputs = [ "out" ] ++ lib.optional docSupport "devdoc"; + nativeBuildInputs = [ autoreconfHook bison ] ++ (op docSupport groff) ++ op (stdenv.buildPlatform != stdenv.hostPlatform) buildPackages.ruby; @@ -115,6 +117,10 @@ let ++ op (stdenv.hostPlatform != stdenv.buildPlatform) "--with-baseruby=${buildRuby}"; + preConfigure = opString docSupport '' + configureFlagsArray+=("--with-ridir=$devdoc/share/ri") + ''; + # fails with "16993 tests, 2229489 assertions, 105 failures, 14 errors, 89 skips" # mostly TZ- and patch-related tests # TZ- failures are caused by nix sandboxing, I didn't investigate others @@ -144,12 +150,26 @@ let addGemPath() { addToSearchPath GEM_PATH \$1/${passthru.gemPath} } + addRubyLibPath() { + addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby + addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir} + addToSearchPath RUBYLIB \$1/lib/ruby/site_ruby/${ver.libDir}/${stdenv.targetPlatform.system} + } addEnvHooks "$hostOffset" addGemPath + addEnvHooks "$hostOffset" addRubyLibPath EOF - '' + opString useRailsExpress '' - rbConfig=$(find $out/lib/ruby -name rbconfig.rb) + rbConfig=$(find $out/lib/ruby -name rbconfig.rb) + '' + opString docSupport '' + # Prevent the docs from being included in the closure + sed -i "s|\$(DESTDIR)$devdoc|\$(datarootdir)/\$(RI_BASE_NAME)|" $rbConfig + sed -i "s|'--with-ridir=$devdoc/share/ri'||" $rbConfig + + # Add rbconfig shim so ri can find docs + mkdir -p $devdoc/lib/ruby/site_ruby + cp ${./rbconfig.rb} $devdoc/lib/ruby/site_ruby/rbconfig.rb + '' + opString useRailsExpress '' # Prevent the baseruby from being included in the closure. sed -i '/^ CONFIG\["BASERUBY"\]/d' $rbConfig sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig |