Subject: Re: ['PATCH v2' 01/14] build-system: Add mix-build-system.

From: Pierre-Henry Fröhring <[email-masked]>
Date: Tue, 14 Nov 2023 11:37:10 +0100

> > +(define-module (guix build-system mix)
> > +  #:use-module (gnu packages base)
> > +  #:use-module (gnu packages elixir)
> > +  #:use-module (gnu packages elixir-xyz)
> > +  #:use-module (gnu packages erlang)
> You probably want to resolve those imports rather than use-modules
> them.

You mean something like this?
#+begin_src scheme
(define-module (guix build-system mix)
  #:use-module ((gnu packages base) #:select (glibc
make-glibc-utf8-locales))
  #:use-module ((gnu packages elixir) #:select (elixir elixir-hex))
  #:use-module ((gnu packages erlang) #:select (rebar3))
#+end_src

I have moved `elixir-hex' to elixir.scm to avoid a circular dependency.

> > +(define (input=? input1 input2)
> > +  "Tell whether inputs INPUT1 and INPUT2 are equal."
> > +  (define pkg1 (match input1 ((_ pkg) pkg)))
> > +  (define pkg2 (match input2 ((_ pkg) pkg)))
> > +  (string=? (package-name pkg1) (package-name pkg2)))
> Again, checking for label equivalence is a bad idea.

OK, after reading a bit more about Guile, I understand that `equal?'
is what should be used here, right? The intent is to remove duplicated
inputs in the code below:

#+begin_src scheme
(define all-propagated-inputs
    ((compose
      (cut delete-duplicates <> equal?) ;<-- Here
      (cut filter erlang-or-elixir-input? <>)
      (cut append-map package-transitive-propagated-inputs <>)
      (cut map cadr <>))
     (append inputs native-inputs)))
#+end_src

> > +(define (elixir-input? X.Y input)
> > +  "Determines if the given INPUT is an Elixir input."
> > +  (match input
> > +    ((label . path)
> > +     ;; XXX: The second condition may be enough.
> > +     (and (elixir-name? label)
> > +          (directory-exists? (path->elixir-lib path X.Y))))))
> Ahem, search-path-as-list.
> Also, leaking the version is kinda bad, API-wise.

Does this mean that build artifacts should be installed under
`$out/lib/elixir/$libname` instead of `$out/lib/elixir/X.Y/$libname`?

Cheers