From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marius Bakke Subject: Re: using guix for ruby development Date: Fri, 16 Feb 2018 19:44:53 +0100 Message-ID: <87h8qgvknu.fsf@fastmail.com> References: <87a7wato8i.fsf@santanas.co.za> <877eretnuw.fsf@santanas.co.za> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eml0F-0005Uc-Ur for help-guix@gnu.org; Fri, 16 Feb 2018 13:45:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eml0C-000831-Qc for help-guix@gnu.org; Fri, 16 Feb 2018 13:45:00 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:58817) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eml0C-00081V-Gn for help-guix@gnu.org; Fri, 16 Feb 2018 13:44:56 -0500 In-Reply-To: <877eretnuw.fsf@santanas.co.za> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Divan Santana , help-guix@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Divan Santana writes: > Divan Santana writes: > >> Hi all, >> >> So I'm *trying* to use guix on Parabola Linux to provide the rubies and >> replace some other functionality of like chruby for instance. >> >> I'm a bit of a noob with guix and even ruby, so it's a bit of a >> challenge. >> >> I've read through these nice notes[1] by Pjotr. The answers I'm looking >> for, may well be in there but I might have missed it. >> >> [1]: >> - https://gitlab.com/pjotrp/guix-notes/blob/master/RUBY.org >> - https://gitlab.com/pjotrp/guix-notes/blob/master/RUBYGEMS-Nokogiri= .org >> >> I've also used the linked in script[2] which helps. >> >> [2]: https://gitlab.com/pjotrp/guix-notes/blob/master/scripts/ruby-guix-= env >> >> Anyway the issue: >> >> $ gem env >> RubyGems Environment: >> - RUBYGEMS VERSION: 2.6.14 >> - RUBY VERSION: 2.4.3 (2017-12-14 patchlevel 205) [x86_64-linux] >> - INSTALLATION DIRECTORY: /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3y= ghig0ll-ruby-2.4.3/2.4.0 >> - USER INSTALLATION DIRECTORY: /home/admin/.gem/ruby/2.4.0 >> - RUBY EXECUTABLE: /gnu/store/sx7ih0vgp7q8zj7k58xjvnp3yghig0ll-ruby-= 2.4.3/bin/ruby >> - EXECUTABLE DIRECTORY: /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3ygh= ig0ll-ruby-2.4.3/2.4.0/bin >> - SPEC CACHE DIRECTORY: /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3ygh= ig0ll-ruby-2.4.3/specs >> - SYSTEM CONFIGURATION DIRECTORY: /gnu/store/sx7ih0vgp7q8zj7k58xjvnp= 3yghig0ll-ruby-2.4.3/etc >> - RUBYGEMS PLATFORMS: >> - ruby >> - x86_64-linux >> - GEM PATHS: >> - /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3yghig0ll-ruby-2.4.3/2.= 4.0 >> - /home/admin/.guix-profile/lib/ruby/vendor_ruby >> - /home/admin/.guix-profile/lib/ruby/gems/2.4.0/ >> - GEM CONFIGURATION: >> - :update_sources =3D> true >> - :verbose =3D> true >> - :backtrace =3D> false >> - :bulk_threshold =3D> 1000 >> - "gem" =3D> "--no-rdoc" >> - REMOTE SOURCES: >> - https://rubygems.org/ >> - SHELL PATH: >> - /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3yghig0ll-ruby-2.4.3/2.= 4.0/bin >> - /home/admin/src/ds-config/guile/scripts >> - /home/admin/src/ds-config/bin >> - /home/admin/.node_modules/node_modules/.bin >> - /home/admin/.guix-profile/bin >> - /home/admin/src/ds-config/guile/scripts >> - /home/admin/src/ds-config/bin >> - /home/admin/.node_modules/node_modules/.bin >> - /home/admin/.guix-profile/bin >> - /usr/local/sbin >> - /usr/local/bin >> - /usr/bin >> - /usr/lib/jvm/default/bin >> - /usr/bin/site_perl >> - /usr/bin/vendor_perl >> - /usr/bin/core_perl >> >> So I'm in a ruby project. I type `bundle install` to install the gems. >> >> It goes and fetches the missing gems and installs them in /home/admin/.g= em/sx7ih0vgp7q8zj7k58xjvnp3yghig0ll-ruby-2.4.3/2.4.0/gems/ >> >> That's great. I fire up the project[3] with: >> >> [3]: https://gitlab.com/gitlab-com/gitlab-docs (using an older commit >> because ruby25 is not yet in guix repos. >> >> $ bundle exec nanoc live >> >> Captain! We=E2=80=99ve been hit! >> >> LoadError: liblzma.so.5: cannot open shared object file: No such file = or directory - /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3yghig0ll-ruby-2.4.3= /2.4.0/gems/nokogiri-1.7.2/lib/nokogiri/nokogiri.so >> >> $ ldd /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3yghig0ll-ruby-2.4.3/2.4= .0/gems/nokogiri-1.7.2/lib/nokogiri/nokogiri.so >> linux-vdso.so.1 (0x00007ffff6b10000) >> libm.so.6 =3D> /usr/lib/libm.so.6 (0x00007f469080f000) >> libdl.so.2 =3D> /usr/lib/libdl.so.2 (0x00007f469060b000) >> liblzma.so.5 =3D> /usr/lib/liblzma.so.5 (0x00007f46903e5000) >> libz.so.1 =3D> /usr/lib/libz.so.1 (0x00007f46901ce000) >> libpthread.so.0 =3D> /usr/lib/libpthread.so.0 (0x00007f468ffb0= 000) >> libcrypt.so.1 =3D> /usr/lib/libcrypt.so.1 (0x00007f468fd78000) >> libc.so.6 =3D> /usr/lib/libc.so.6 (0x00007f468f9c1000) >> /usr/lib64/ld-linux-x86-64.so.2 (0x00007f4690f97000) >> >> Guessing the reason is because it seems to compile against the OS system >> and not the "guix system". And that could cause problems? >> >> Other gems also are like this. >> >> $ ldd /home/admin/.gem/sx7ih0vgp7q8zj7k58xjvnp3yghig0ll-ruby-2.4.3/2.4= .0/gems/ffi-1.9.18/lib/ffi_c.so >> linux-vdso.so.1 (0x00007ffd1bdf1000) >> libffi.so.6 =3D> /usr/lib/libffi.so.6 (0x00007f6af531e000) >> libpthread.so.0 =3D> /usr/lib/libpthread.so.0 (0x00007f6af5100= 000) >> libdl.so.2 =3D> /usr/lib/libdl.so.2 (0x00007f6af4efc000) >> libcrypt.so.1 =3D> /usr/lib/libcrypt.so.1 (0x00007f6af4cc4000) >> libm.so.6 =3D> /usr/lib/libm.so.6 (0x00007f6af4978000) >> libc.so.6 =3D> /usr/lib/libc.so.6 (0x00007f6af45c1000) >> /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6af574c000) >> >> I could install ruby-nokogiri via guix but that provides 1.8 and I need >> 1.7. :( >> >> Is there a simple way of getting these gems installed to use guix system >> libs so things don't break? > > So for this particular project I managed to get it working via changing > the Gemfile to up the version on nokogiri to 1.8 so I can use the > nokogiri from guix. Did the same with ffi which had similar issue. > > That's not ideal as one may need a diff version or the gem may not be > packaged yet. > > Any thoughts? Mixing Guix packages with other package managers can be difficult. In this situation I would write a "Guixfile" and use that instead of Bundler. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=Guixfile.scm (use-modules (guix build-system ruby) ((guix licenses) #:prefix license:) (guix download) (guix packages) (gnu packages ruby)) (define-public ruby-nokogiri-1.7 (package (inherit ruby-nokogiri) (version "1.7.0") (source (origin (method url-fetch) (uri (rubygems-uri "nokogiri" version)) (sha256 (base32 "1qx2adp6gdnaipvv0nshiq2hgnra44c8j5vkjjfm73sr9wbdmbk3")))))) (define-public gitlab-docs (package (name "gitlab-docs") (version "master") (source (dirname (current-filename))) (build-system ruby-build-system) (propagated-inputs `(("ruby-nokogiri" ,ruby-nokogiri-1.7) ("ruby-redcarpet" ,ruby-redcarpet))) (home-page "https://gitlab.com/gitlab-com/gitlab-docs") (synopsis "GitLab documentation") (description "Documentation for the GitLab git server") (license license:expat))) gitlab-docs --=-=-= Content-Type: text/plain And then start the environment with `guix environment -l Guixfile.scm`. I see the Gemfile requires some gems that are not available in Guix yet, so I would attempt to write package definitions for those as well. Hope this helps! --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlqHJqUACgkQoqBt8qM6 VPrFhQf/XFnqdJrYkNV1biRt9u38+gqI15RaPJhdoiuR3FZNfkgvP3+cKEoK57Yu VhwUv0oM+jEmwzsMMVA34gjeXjQGcZVHCYipG9lxkp2j0yjkZeMfXjZDisKCE7va PsYJvS9r+vxZCnFa8nSz7x1W6+pPRMNZPBfEM3JQpS3l3ZL6n48pr06lbeD6zxxK iENhRMmh/GVZGNJ65405rUCNzcnw2a6phZgdavbqoFDzPxX/W9HpsULwlmz8Ugwr uvoTzMDIvbnCrTKmDiuxHyj8QwpxnyKXLD1QI9c8RCJ89+nkfDQ5N9XtQZwu1mCw DPOQUvT6LBpYBeK8xUzsy29YTpGlsA== =dRRR -----END PGP SIGNATURE----- --==-=-=--