Hi there
I’m slowly switching to nix to handle the setup of my dev environment on my M1 MBP.
I’ve been using a nix-shell for most of the projects I’m working on and this has been working fine.
However, I can’t get ruby-vips to work in one of my rails projects: it keep looking for some libraries, even though I’ve tried to include them.
The shell looks like this:
let
pkgs = import <nixpkgs> { };
in
pkgs.mkShell {
buildInputs = with pkgs; [
nodejs-16_x
postgresql_14
ruby_3_0
# We need to exclude the optional dependency libjxl, since it is broken
# see issue https://github.com/libjxl/libjxl/issues/213
(vips.override { libjxl = null; })
yarn
];
shellHook = ''
export GEM_HOME="$PWD/vendor/bundle/$(ruby -e 'puts RUBY_VERSION')"
export PATH="$GEM_HOME/bin:$PATH"
'';
}
Every time vips gets used, I get the following error:
LoadError (Could not open library 'glib-2.0.0': dlopen(glib-2.0.0, 0x0005): tried: '/nix/store/l0rp423b2w8b065w5cdx4s3hanjx464x-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/glib-2.0.0' (no such file), '/nix/store/l0rp423b2w8b065w5cdx4s3hanjx464x-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/glib-2.0.0' (no such file), 'glib-2.0.0' (no such file), '/usr/local/lib/glib-2.0.0' (no such file), '/usr/lib/glib-2.0.0' (no such file), '/Users/robbevp/Documents/code/...project_name.../glib-2.0.0' (no such file), '/usr/local/lib/glib-2.0.0' (no such file), '/usr/lib/glib-2.0.0' (no such file).
Could not open library 'libglib-2.0.0.dylib': dlopen(libglib-2.0.0.dylib, 0x0005): tried: '/nix/store/l0rp423b2w8b065w5cdx4s3hanjx464x-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/libglib-2.0.0.dylib' (no such file), '/nix/store/l0rp423b2w8b065w5cdx4s3hanjx464x-apple-framework-CoreFoundation-11.0.0/Library/Frameworks/libglib-2.0.0.dylib' (no such file), 'libglib-2.0.0.dylib' (no such file), '/usr/local/lib/libglib-2.0.0.dylib' (no such file), '/usr/lib/libglib-2.0.0.dylib' (no such file), '/Users/robbevp/Documents/code/...project_name.../libglib-2.0.0.dylib' (no such file), '/usr/local/lib/libglib-2.0.0.dylib' (no such file), '/usr/lib/libglib-2.0.0.dylib' (no such file)):
ffi (1.15.3) lib/ffi/library.rb:145:in `block in ffi_lib'
ffi (1.15.3) lib/ffi/library.rb:99:in `map'
ffi (1.15.3) lib/ffi/library.rb:99:in `ffi_lib'
ruby-vips (2.1.2) lib/vips.rb:45:in `<module:GLib>'
ruby-vips (2.1.2) lib/vips.rb:36:in `<main>'
glib should be included by vips, so I’m unsure what I’m doing wrong. In my old setup, I had vips installed via homebrew and that worked without issues.
I currently can get by with this error showing up every now and then (since image processing is not that important functionality to this project) - but it would be nice to complete this set up.
Any help is very much appreciated!