Subject: bug#68835: Resolving package inheritance issue

From: Simon Tournier <[email-masked]>
Date: Thu, 01 Feb 2024 14:27:24 +0100

Hi,

On Wed, 31 Jan 2024 at 01:01, Sharlatan Hellseher <[email-masked]> wrote:

> My rational was to keep golang module in (gnu packages golang-web) and
> the new inherited package providing executable in (gnu packages web)
> which introduced the regression.

As said by Josselin, the manual provides some explanations for this kind
of situations.

    https://guix.gnu.org/manual/devel/en/guix.html#Cyclic-Module-Dependencies

Roughly speaking, your proposal for Go language packages breaks because
more or less « Because the ‘inherit’ field is not delayed (thunked), it
is evaluated at the top level at load time, which is problematic in the
presence of module dependency cycles. »

The “fix” would to wrap it using a procedure; as explained in the
manual.  Something like:

    (define (make-minify)
      (package
        (inherit go-github-com-tdewolff-minify-v2)
        (name "minify")
        (arguments
         (substitute-keyword-arguments
             (package-arguments go-github-com-tdewolff-minify-v2)
           ((#:install-source? _ #t) #f)
           ((#:import-path _ "github.com/tdewolff/minify/v2")
            "github.com/tdewolff/minify/cmd/minify"))))
         
Well, then it is not clear for me how the user would access to this
package but somehow that’s another story. :-)x

As Josselin, I would suggest to keep in the same Guile module the
original package and its variants created using ’inherit’; well as the
general rule.

Cheers,
simon