Hi Hilton,

I've been working on an unrelated effort out-of-tree to create something
to manage Ruby development environments. Similar to Bundix from Nix.

https://git.sr.ht/~czan/guix-ruby

I mention this, because I think it has some similarities to what you're
describing.

On Fri, Mar 07 2025, Hilton Chain wrote:
> I think the approach I'm currently experimenting with for our Rust ecosystem 
> can
> be applied to Go as well:
>
> 1. Import dependencies from lockfile as <origin>s

In guix-ruby I create a Gemfile.lock.scm file, which represents the
dependencies of a project. An example is here:

https://git.sr.ht/~czan/speedrail/tree/master/item/Gemfile.lock.scm

> 2. Only package complex dependencies

Since I want to be able to regenerate a lock file and not require user
modifications, guix-ruby has "gem-transformers" which are used to do
anything extra that a package needs beyond the default build.

https://git.sr.ht/~czan/guix-ruby/tree/main/item/guix-ruby/gems.scm#L32

There is a list of %default-gem-transformers to handle the things that I
can, but you can also add your own when you load the lock file. This is
done in the user's manifest.scm, so it is unaffected by regenerating the
Gemfile.lock.scm file.

Using transformers makes the system less sensitive to the specific
versions of packages. For instance, I implement a gem-transformer for
the "pg" gem to add Postgres as an input, and that will probably work
for every version of the "pg" gem. (If not, you can have a condition on
the version, too.)

> 3. Make the build system aware of Go inputs and unpack them

I don't have an equivalent to this, because my packages end up packaged
as regular Guix packages. Ruby can just find things based on environment
variables.

Obviously what I'm trying to do is a bit different, so I'm not sure that
any of this is actually helpful.

Carlo

Reply via email to