* Ruby without RVM - what to do if the version I want is missing?
@ 2024-06-14 15:43 Daniel Littlewood
2024-06-14 16:15 ` Felix Lechner via
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Daniel Littlewood @ 2024-06-14 15:43 UTC (permalink / raw)
To: help-guix
Hi Guix,
I am trying to migrate from Debian to Guix. I am used to using
RVM/rbenv to manage my ruby versions, but I don't think they're
packaged for guix. They also obviously go against the grain of having
guix manage all your software.
Long story short, my project requires Ruby 3.3.0, and the latest
packaged version is 3.2.3. I have one main question and a followup. I
read David Thompson's article "Ruby on Guix" so I will refer to that
when I'm trying to describe things.
(https://dthompson.us/posts/ruby-on-guix.html)
1. Suppose I am prepared to package Ruby 3.3.0 myself. I imagine that
the packaging steps for 3.3.0 are extremely similar to 3.2.3 (probably
they are identical).
1a. Which parts of the manual should I read to figure out how to write
a new package? In the article there is one expression that begins
`(package (name ruby-pry)...` and another `(define-public ruby-pg
(package (name "ruby-pg")...`. What is the significance of
define-public?
1b. If I manage to write a package expression for ruby 3.3.0, how do I
then refer to it in my package.scm? I assume I have to require a
module somehow, but I know very little scheme.
1c. Given that 3.3.0 is probably almost identical to 3.2.3, I would
like to copy the original file and just tweak the details in my local
project. I think I found that via packages.guix.gnu.org, here:
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/ruby.scm#n279.
Is that the right expression (if I just copy it, should I expect it to
work)?
and for my followup,
2. Now imagine I've packaged it correctly and it works locally. I
assume it would be a good thing to upstream that file.
2a. Is it actually desirable to upstream that? I notice not every
version of ruby is packaged. But I think similarly to the previous
section it should be not too hard to package every version (major and
minor). Is there a principled reason not to do this, or is it just
lack of maintainers?
2b. If there is a principled reason, like we don't want the guix
packages repo to be too big, would it be useful for someone to have
another channel where things like extra ruby versions are packaged and
pre-built?
I think this second question is important for people like me who are
considering using Guix to replace things like RVM. It might be that
guix proper has high standards for packaging, but I know I wouldn't
mind if there was a lower standard for stuff being pulled naively via
rubygems or whatever.
Best wishes, thank you for reading,
Dan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-14 15:43 Ruby without RVM - what to do if the version I want is missing? Daniel Littlewood
@ 2024-06-14 16:15 ` Felix Lechner via
2024-06-14 17:36 ` Andreas Enge
2024-06-15 7:43 ` Remco van 't Veer
2 siblings, 0 replies; 10+ messages in thread
From: Felix Lechner via @ 2024-06-14 16:15 UTC (permalink / raw)
To: Daniel Littlewood, help-guix
Hi Daniel,
On Fri, Jun 14 2024, Daniel Littlewood wrote:
> I am trying to migrate from Debian to Guix.
Congratulations & welcome! I did the same thing two and half years ago.
The next two months were some of the most painful weeks in my life, but
now I'm in a very happy place.
> I am used to using RVM/rbenv to manage my ruby versions
Unfortunately, I cannot help you with Ruby and will leave that to others
reading this list .
> Which parts of the manual should I read
Please put both the Guix and the Guile manual on speed dial. An easy
way to do that is to type "C-h R" in Emacs and them select the manual.
Typing "i" will search the index of that manual.
Over time you will memorize large parts of both manuals.
You may be able to find some Scheme help in the IRC channel #scheme on
Libera.chat.
> `(package (name ruby-pry)...` and another `(define-public ruby-pg
> (package (name "ruby-pg")...`. What is the significance of
> define-public?
The (package declaration is a Guix record. [1] Those can be confusing
because field names do not result in command execution even though they
follow an opening parenthesis.
The procedure 'define-public' will define a new variable and export it
for use in other modules. [2]
> would it be useful for someone to have another channel where things
> like extra ruby versions are packaged and pre-built?
Almost everyone here has their own channel or contributes to a channel
outside the mainline.
> I wouldn't mind if there was a lower standard for stuff being pulled
> naively via rubygems or whatever.
You are not alone. A lot of folks at Guix would appreciate that type of
automation. Please have a look at 'guix import'. [3]
Good luck & thanks for trying GNU Guix!
Kind regards
Felix
[1] https://lepiller.eu/en/a-deep-dive-into-guix-records.html
[2] https://www.gnu.org/software/guile/manual/html_node/Creating-Guile-Modules.html#index-define_002dpublic
[3] https://guix.gnu.org/manual/devel/en/html_node/Invoking-guix-import.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-14 15:43 Ruby without RVM - what to do if the version I want is missing? Daniel Littlewood
2024-06-14 16:15 ` Felix Lechner via
@ 2024-06-14 17:36 ` Andreas Enge
2024-06-15 6:39 ` Nils Landt
2024-06-16 10:27 ` Andreas Enge
2024-06-15 7:43 ` Remco van 't Veer
2 siblings, 2 replies; 10+ messages in thread
From: Andreas Enge @ 2024-06-14 17:36 UTC (permalink / raw)
To: Daniel Littlewood; +Cc: help-guix, Christopher Baines
Hello Dan,
I know very little about Ruby either, except that updates seem to go
relatively smoothly compared to other modern languages. Adding a new
version is quite trivial, here is one:
(define-public ruby-3.3
(package
(inherit ruby-3.2)
(version "3.3.3")
(source
(origin
(method url-fetch)
(uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
(version-major+minor version)
"/ruby-" version ".tar.xz"))
(sha256
(base32
"07pwf3zkf7idl95agfjbv2lvamcp0spp0znqp9arb71ri19rkh43"))))))
I have sent this patch, see
https://issues.guix.gnu.org/71559
An interesting question would be whether all the packages that still depend
on ruby@3.1 can use ruby@3.2 or ruby@3.3 instead.
And whether we still need ruby@2.6 in addition to ruby@2.7; no package
depends on the former.
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-14 17:36 ` Andreas Enge
@ 2024-06-15 6:39 ` Nils Landt
2024-06-16 10:27 ` Andreas Enge
1 sibling, 0 replies; 10+ messages in thread
From: Nils Landt @ 2024-06-15 6:39 UTC (permalink / raw)
To: Andreas Enge; +Cc: help-guix
> Andreas Enge <andreas@enge.fr> hat am 14.06.2024 19:36 CEST geschrieben:
>
> An interesting question would be whether all the packages that still depend
> on ruby@3.1 can use ruby@3.2 or ruby@3.3 instead.
There are breaking changes between these Ruby versions.
For most packages, upgrading Ruby and having the tests run would work, but I count 209 packages with tests disabled (I did not check how many of them run on 2.7).
Personally, I wouldn't want to risk it :)
> And whether we still need ruby@2.6 in addition to ruby@2.7; no package
> depends on the former.
Probably not, end of support for Ruby 2.6 was 2022-04-12.
Fwiw, end of support for 2.7 was 2023-03-30. The 2.7 -> 3.0 migration was pretty big in the Ruby ecosystem, I wouldn't expect there to be a lot of open source applications running 2.7 any more. Having a quick look at (gnu packagages ruby), very few packages still depend on 2.7.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-14 15:43 Ruby without RVM - what to do if the version I want is missing? Daniel Littlewood
2024-06-14 16:15 ` Felix Lechner via
2024-06-14 17:36 ` Andreas Enge
@ 2024-06-15 7:43 ` Remco van 't Veer
2 siblings, 0 replies; 10+ messages in thread
From: Remco van 't Veer @ 2024-06-15 7:43 UTC (permalink / raw)
To: Daniel Littlewood; +Cc: help-guix
Hi Daniel,
I replaced rvm on guix with direnv and guix manifests. Most for the
projects I work on are on different versions of ruby and some which are
not packaged for guix. The way I do this is as follows.
First I create a .guix.scm file in the root of my project as follows:
(use-modules (gnu packages)
(gnu packages ruby)
(guix packages)
(guix utils))
(let* ((ruby-version "3.3.0")
(ruby (package
(inherit ruby-3.2)
(version ruby-version)
(source
(origin
(inherit (package-source ruby-3.2))
(uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
(version-major+minor ruby-version)
"/ruby-" ruby-version ".tar.xz"))
(sha256
(base32
"0nwpgf27i43yd8ccsk838n86n9xki68hayxmhbwr0zk3dsinasv7")))))))
(concatenate-manifests
(list
(packages->manifest (list ruby))
;; base for building extensions
(package->development-manifest ruby))))
And run:
guix package -p .guix -m .guix.scm
This creates a profile containing ruby-3.3.0 in the .guix directory
(with is actually a link the a version of that profile) which includes
enough to build basic gems with native code (the development manifest
for ruby itself) kinda like installing debians build-essentials. If you
need any libraries to compile some gem add them here too.
Now create a .envrc file as follows:
GUIX_PROFILE="$(expand_path .guix)"
[ -f "$GUIX_PROFILE/etc/profile" ] ||
guix package -p "$GUIX_PROFILE" -m .guix.scm
source "$GUIX_PROFILE/etc/profile"
export GEM_HOME="$(expand_path .gems)"
export GEM_PATH="$GEM_HOME"
PATH_add $GEM_HOME/bin
This makes sure the profile gets automatically loaded when you "enter"
the project and sets up GEM_HOME so all gems installed for this project
are kept in the local .gems. Read the direnv documentation to figure
out how to set that up to make "entering" the project work for your dev
environment. I use the envrc emacs package which work very well for me.
I use the about method for other kinds of projects too.
Cheers,
Remco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-14 17:36 ` Andreas Enge
2024-06-15 6:39 ` Nils Landt
@ 2024-06-16 10:27 ` Andreas Enge
2024-06-17 19:09 ` Daniel Littlewood
1 sibling, 1 reply; 10+ messages in thread
From: Andreas Enge @ 2024-06-16 10:27 UTC (permalink / raw)
To: Daniel Littlewood; +Cc: help-guix, Christopher Baines, 71559-done
Hello,
Am Fri, Jun 14, 2024 at 07:36:07PM +0200 schrieb Andreas Enge:
> (define-public ruby-3.3
> (package
> (inherit ruby-3.2)
> (version "3.3.3")
> (source
> (origin
> (method url-fetch)
> (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
> (version-major+minor version)
> "/ruby-" version ".tar.xz"))
> (sha256
> (base32
> "07pwf3zkf7idl95agfjbv2lvamcp0spp0znqp9arb71ri19rkh43"))))))
> I have sent this patch, see
> https://issues.guix.gnu.org/71559
QA has given the green light, so I have pushed this new version to master.
You should see it after a "guix pull".
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-16 10:27 ` Andreas Enge
@ 2024-06-17 19:09 ` Daniel Littlewood
2024-06-17 19:09 ` [bug#71559] " Daniel Littlewood
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Daniel Littlewood @ 2024-06-17 19:09 UTC (permalink / raw)
To: Andreas Enge; +Cc: help-guix, Christopher Baines, 71559-done
Hi, thank you all very much for the help,
Thank you Andreas for your patch. I wasn't sure quite how to use it at
first, but after some looking I found out I could put it into a local
channel. So I made a file ~/my-channel/ruby.scm with contents
(define-module (ruby)
#:use-module (guix packages)
#:use-module (guix licenses)
#:use-module (guix download)
#:use-module (guix utils)
#:use-modules (gnu packages ruby))
<the contents of your patch here>
That worked well.
guix shell ruby@3.3 # fails as expected
guix shell -L ~/guix-scout ruby@3.3 # works
ruby --version
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [x86_64-linux]
However I wanted to have a more sophisticated guix shell, called from
a file. Something like what Remco suggested, but this was just what I
could cobble together and it isn't exactly the same.
The file guix.scm contains (by the way, why is the use-modules syntax
different here?)
(use-modules (guix packages)
(guix download)
(guix utils)
(guix build-system ruby)
(ruby))
(package
(name "my-project")
(version "1.0.0")
(license #f)
(source #f)
(build-system ruby-build-system) ; "no build system" was not an option
(propagated-inputs (list ruby-3.3))
(synopsis "")
(description "")
(homepage ""))
Now I become confused:
guix shell -L ~/my-channel -D -f guix.scm # works, as expected
ruby --version
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]
# this is *not* the host ruby:
exit
ruby --version
ruby 2.7.8p225 (2023-03-30 revision 1fd455848) [x86_64-linux]
I don't know where it is getting 3.1.4 from! I have not written it
anywhere. I do recognise it - I think I have previously installed it
at some point. But I don't know where it's being pulled from - some
cache? It looks like Remco's approach using manifests should work, but
I wonder: does anyone know what's wrong with my guix.scm?
Best wishes,
Dan
On Sun, Jun 16, 2024 at 11:27 AM Andreas Enge <andreas@enge.fr> wrote:
>
> Hello,
>
> Am Fri, Jun 14, 2024 at 07:36:07PM +0200 schrieb Andreas Enge:
> > (define-public ruby-3.3
> > (package
> > (inherit ruby-3.2)
> > (version "3.3.3")
> > (source
> > (origin
> > (method url-fetch)
> > (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
> > (version-major+minor version)
> > "/ruby-" version ".tar.xz"))
> > (sha256
> > (base32
> > "07pwf3zkf7idl95agfjbv2lvamcp0spp0znqp9arb71ri19rkh43"))))))
> > I have sent this patch, see
> > https://issues.guix.gnu.org/71559
>
> QA has given the green light, so I have pushed this new version to master.
> You should see it after a "guix pull".
>
> Andreas
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [bug#71559] Ruby without RVM - what to do if the version I want is missing?
2024-06-17 19:09 ` Daniel Littlewood
@ 2024-06-17 19:09 ` Daniel Littlewood
2024-06-19 15:50 ` Remco van 't Veer
2024-06-20 17:09 ` Andreas Enge
2 siblings, 0 replies; 10+ messages in thread
From: Daniel Littlewood @ 2024-06-17 19:09 UTC (permalink / raw)
To: Andreas Enge; +Cc: 71559-done, Christopher Baines, help-guix
Hi, thank you all very much for the help,
Thank you Andreas for your patch. I wasn't sure quite how to use it at
first, but after some looking I found out I could put it into a local
channel. So I made a file ~/my-channel/ruby.scm with contents
(define-module (ruby)
#:use-module (guix packages)
#:use-module (guix licenses)
#:use-module (guix download)
#:use-module (guix utils)
#:use-modules (gnu packages ruby))
<the contents of your patch here>
That worked well.
guix shell ruby@3.3 # fails as expected
guix shell -L ~/guix-scout ruby@3.3 # works
ruby --version
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [x86_64-linux]
However I wanted to have a more sophisticated guix shell, called from
a file. Something like what Remco suggested, but this was just what I
could cobble together and it isn't exactly the same.
The file guix.scm contains (by the way, why is the use-modules syntax
different here?)
(use-modules (guix packages)
(guix download)
(guix utils)
(guix build-system ruby)
(ruby))
(package
(name "my-project")
(version "1.0.0")
(license #f)
(source #f)
(build-system ruby-build-system) ; "no build system" was not an option
(propagated-inputs (list ruby-3.3))
(synopsis "")
(description "")
(homepage ""))
Now I become confused:
guix shell -L ~/my-channel -D -f guix.scm # works, as expected
ruby --version
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]
# this is *not* the host ruby:
exit
ruby --version
ruby 2.7.8p225 (2023-03-30 revision 1fd455848) [x86_64-linux]
I don't know where it is getting 3.1.4 from! I have not written it
anywhere. I do recognise it - I think I have previously installed it
at some point. But I don't know where it's being pulled from - some
cache? It looks like Remco's approach using manifests should work, but
I wonder: does anyone know what's wrong with my guix.scm?
Best wishes,
Dan
On Sun, Jun 16, 2024 at 11:27 AM Andreas Enge <andreas@enge.fr> wrote:
>
> Hello,
>
> Am Fri, Jun 14, 2024 at 07:36:07PM +0200 schrieb Andreas Enge:
> > (define-public ruby-3.3
> > (package
> > (inherit ruby-3.2)
> > (version "3.3.3")
> > (source
> > (origin
> > (method url-fetch)
> > (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
> > (version-major+minor version)
> > "/ruby-" version ".tar.xz"))
> > (sha256
> > (base32
> > "07pwf3zkf7idl95agfjbv2lvamcp0spp0znqp9arb71ri19rkh43"))))))
> > I have sent this patch, see
> > https://issues.guix.gnu.org/71559
>
> QA has given the green light, so I have pushed this new version to master.
> You should see it after a "guix pull".
>
> Andreas
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-17 19:09 ` Daniel Littlewood
2024-06-17 19:09 ` [bug#71559] " Daniel Littlewood
@ 2024-06-19 15:50 ` Remco van 't Veer
2024-06-20 17:09 ` Andreas Enge
2 siblings, 0 replies; 10+ messages in thread
From: Remco van 't Veer @ 2024-06-19 15:50 UTC (permalink / raw)
To: Daniel Littlewood; +Cc: help-guix
Hi Daniel,
2024/06/17, Daniel Littlewood:
> The file guix.scm contains (by the way, why is the use-modules syntax
> different here?)
> (use-modules (guix packages)
> (guix download)
> (guix utils)
> (guix build-system ruby)
> (ruby))
> (package
> (name "my-project")
> (version "1.0.0")
> (license #f)
> (source #f)
> (build-system ruby-build-system) ; "no build system" was not an option
> (propagated-inputs (list ruby-3.3))
> (synopsis "")
> (description "")
> (homepage ""))
>
> Now I become confused:
> guix shell -L ~/my-channel -D -f guix.scm # works, as expected
> ruby --version
> ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]
> # this is *not* the host ruby:
> exit
> ruby --version
> ruby 2.7.8p225 (2023-03-30 revision 1fd455848) [x86_64-linux]
>
> I don't know where it is getting 3.1.4 from! I have not written it
> anywhere. I do recognise it - I think I have previously installed it
> at some point. But I don't know where it's being pulled from - some
> cache? It looks like Remco's approach using manifests should work, but
> I wonder: does anyone know what's wrong with my guix.scm?
I think you're getting the build dependency of ruby-3.3 because you're
using -D to get the development dependencies of the defined package. It
should probably work when you use "inputs" instead of
"propagated-inputs" here when using -D.
I've never used "propagated-inputs" but I think this is not the way to
use them. A typical use, I think, would be some package which enhances
some other package. So say you have a package "foo" which you could
install to do it's thing but there's also "foo-with-superpowers" which
depends on "foo" being installed but add superpowers to that command and
function through the original package.
Cheers,
Remco
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Ruby without RVM - what to do if the version I want is missing?
2024-06-17 19:09 ` Daniel Littlewood
2024-06-17 19:09 ` [bug#71559] " Daniel Littlewood
2024-06-19 15:50 ` Remco van 't Veer
@ 2024-06-20 17:09 ` Andreas Enge
2 siblings, 0 replies; 10+ messages in thread
From: Andreas Enge @ 2024-06-20 17:09 UTC (permalink / raw)
To: Daniel Littlewood; +Cc: help-guix, Christopher Baines
Hello Daniel,
Am Mon, Jun 17, 2024 at 08:09:13PM +0100 schrieb Daniel Littlewood:
> Thank you Andreas for your patch. I wasn't sure quite how to use it at
> first, but after some looking I found out I could put it into a local
> channel. So I made a file ~/my-channel/ruby.scm with contents
just in case this was not clear from my previous message, the newest ruby
version is now in Guix. So after "guix pull", one of
guix shell ruby
or
guix package -i ruby
should give you version 3.3.3. (Not using ruby myself, I do not know
whether this will be compatible with all other ruby packages that you may
add to the profile.)
Andreas
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-06-20 17:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-14 15:43 Ruby without RVM - what to do if the version I want is missing? Daniel Littlewood
2024-06-14 16:15 ` Felix Lechner via
2024-06-14 17:36 ` Andreas Enge
2024-06-15 6:39 ` Nils Landt
2024-06-16 10:27 ` Andreas Enge
2024-06-17 19:09 ` Daniel Littlewood
2024-06-17 19:09 ` [bug#71559] " Daniel Littlewood
2024-06-19 15:50 ` Remco van 't Veer
2024-06-20 17:09 ` Andreas Enge
2024-06-15 7:43 ` Remco van 't Veer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).