nixpacks icon indicating copy to clipboard operation
nixpacks copied to clipboard

Ruby: Install ImageMagick when rmagick or mini_magick gems are detected

Open subdigital opened this issue 3 years ago • 4 comments

Feature request

When using the heroku buildpack, no further configuration was needed to deploy an app that depends on ImageMagick.

In a ruby project, when a Gemfile contains either rmagick or mini_magick, nixpacks should automatically add imagemagick nix package as well as the libimagemagick-dev apt package to allow these gems to install successfully without any manual configuration on the user side.

Motivation

ImageMagick is required to be installed when using popular image processing gems such as paperclip or carrierwave. Transitively, these depend on rmagick or mini_magick.

With the experience of using Heroku build packs, I expected this to just work, however required me to add:

NIXPACKS_PKGS=imagemagick
NIXPACKS_APT_PKGS=libimagemagick-dev

Contribution

(not familiar with how to approach this, was requested by fp on Discord to file this)

subdigital avatar Aug 17 '22 13:08 subdigital

Would it be sufficient to read the lockfile to determine if rmagick or mini_magick were implicitly dependended on?

I could read the Gemfile but that doesn't seem bulletproof. Thoughts @subdigital?

JakeCooper avatar Aug 22 '22 23:08 JakeCooper

Yes, Gemfile.lock is the right place

Sent from my iPhone

On Aug 22, 2022, at 6:29 PM, Jake Cooper @.***> wrote:

 Would it be sufficient to read the lockfile to determine if rmagick or mini_magick were implicitly dependended on?

I could read the Gemfile but that doesn't seem bulletproof. Thoughts @subdigital?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

subdigital avatar Aug 23 '22 02:08 subdigital

@subdigital Do you have an example repo that we could pull in to write tests around and build a solution on?

JakeCooper avatar Aug 24 '22 17:08 JakeCooper

Here is my Gemfile.lock

https://gist.github.com/subdigital/acb89c13dc005c0c26297194650a0fb2

You'd want to look for rmagick or minimagick

subdigital avatar Aug 25 '22 01:08 subdigital

@JakeCooper Can I work on this?

IgnisDa avatar Oct 04 '22 01:10 IgnisDa

@JakeCooper Can I work on this?

Sure!

ghost avatar Oct 04 '22 23:10 ghost

I think this issue can be closed now since a PR was already merged

IgnisDa avatar Oct 08 '22 01:10 IgnisDa