Ruby: Difference between revisions

From NixOS Wiki
imported>Samueldr
m forces TOC
imported>Fufexan
m Add page to Development category
Line 42: Line 42:
* [https://github.com/manveru/bundix manveru/bundix] Generates a Nix expression for your Bundler-managed application
* [https://github.com/manveru/bundix manveru/bundix] Generates a Nix expression for your Bundler-managed application
* [https://nixos.org/nixpkgs/manual/#sec-language-ruby Chapter 9.14 Ruby of the nixkgs manual]
* [https://nixos.org/nixpkgs/manual/#sec-language-ruby Chapter 9.14 Ruby of the nixkgs manual]
[[Category: Development]]

Revision as of 20:52, 9 August 2022

Troubleshooting

Trouble with native dependencies

Few gems will force include paths for their native dependencies in the extconf.rb describing their native dependencies.

This issue will exhibit symptoms like being unable to find dependencies that are made available through nix when building; either through bundix or simple bundler calls.

A simple fix is to fork the gem into an alternative location, apply the fix that follows, and then reference the new git repository with fix for the gem.

The fix will probably look like this (for ruby-filemagic):

diff --git a/ext/filemagic/extconf.rb b/ext/filemagic/extconf.rb
index 316e0ab979d243d03a967fda962a43b59a1bbdec..062e91d1023a3363962531fc8a54e7f0feb3bc26 100644
--- a/ext/filemagic/extconf.rb
+++ b/ext/filemagic/extconf.rb
@@ -1,15 +1,11 @@
 require 'mkmf'
 
+# gcc should be able to handle this properly.
 HEADER_DIRS = [
-  '/opt/local/include', # MacPorts
-  '/usr/local/include', # compiled from source and Homebrew
-  '/usr/include',       # system
 ]
 
+# gcc should be able to handle this properly.
 LIB_DIRS = [
-  '/opt/local/lib', # MacPorts
-  '/usr/local/lib', # compiled from source and Homebrew
-  '/usr/lib',       # system
 ]
 
 $CFLAGS << ' -Wall' if ENV['WALL']

See also