all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: "Pierre-Henry Fröhring" <phfrohring@deeplinks.com>,
	66801@debbugs.gnu.org
Subject: [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system.
Date: Mon, 13 Nov 2023 22:22:52 +0100	[thread overview]
Message-ID: <dff0d773a3d24e50760ff49d79dea1b1599d4ec5.camel@gmail.com> (raw)
In-Reply-To: <26ef9c0f4bf2ff942ba2b42e1fadeb6174bbaa6a.1699906775.git.phfrohring@deeplinks.com>

Am Montag, dem 13.11.2023 um 21:26 +0100 schrieb Pierre-Henry Fröhring:
> * guix/build-system/mix.scm,
> * guix/build/mix-build-system.scm: New modules.
> 
> Change-Id: I2cbf6c963a530e73420da0eb17ffaf92827451bf
> ---
>  guix/build-system/mix.scm       | 237 +++++++++++++++++++++++++
>  guix/build/mix-build-system.scm | 303
> ++++++++++++++++++++++++++++++++
>  2 files changed, 540 insertions(+)
>  create mode 100644 guix/build-system/mix.scm
>  create mode 100644 guix/build/mix-build-system.scm
> 
> diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
> new file mode 100644
> index 00000000..ae4407c9
> --- /dev/null
> +++ b/guix/build-system/mix.scm
> @@ -0,0 +1,237 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix.  If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Standard build procedure for Elixir packages using 'mix'.  This
> is
> +;; implemented as an extension of 'gnu-build-system'.
> +;;
> +;; Code:
> +
> +(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.
> +  #:use-module (guix build mix-build-system)
> +  #:use-module (guix build-system gnu)
> +  #:use-module (guix build-system)
> +  #:use-module (guix gexp)
> +  #:use-module (guix monads)
> +  #:use-module (guix packages)
> +  #:use-module (guix search-paths)
> +  #:use-module (guix store)
> +  #:use-module (guix utils)
> +  #:use-module (ice-9 match)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-26)
> +  #:export (mix-build-system hexpm-uri))
> +
> +(define (hexpm-uri name version)
> +  "Return the URI where to fetch the sources of a Hex package NAME
> at VERSION.
> +See: https://github.com/hexpm/specifications/blob/main/endpoints.md"
> +  (string-append "https://repo.hex.pm/tarballs/"
> +                 (string-replace-substring (strip-elixir-prefix
> name) "-" "_")
> +                 "-" version ".tar"))
> +
> +(define glibc-utf8-locales
> +  (make-glibc-utf8-locales glibc
> +                           #:locales (list "en_US")
> +                           #:name "glibc-utf8-locales"))
> +
> +(define (default-elixir)
> +  "Return the default Elixir package."
> +  ;; Lazily resolve the binding to avoid a circular dependency.
> +  (let ((elixir (resolve-interface '(gnu packages elixir))))
> +    (module-ref elixir 'elixir)))
> +
> +(define imported-modules
> +  `((guix build mix-build-system)
> +    ,@%gnu-build-system-modules))
> +
> +(define modules
> +  '((guix build mix-build-system)
> +    (guix build utils)))
> +
> +;; The prefix of Elixir packages.
> +(define %elixir-prefix "elixir-")
> +
> +;; The prefix of Erlang packages.
> +(define %erlang-prefix "erlang-")
> +
> +(define (erlang-package? package)
> +  "Tell whether PACKAGE is an Erlang package."
> +  (string-prefix? %erlang-prefix (package-name package)))
> +
> +(define (elixir-package? package)
> +  "Tell whether PACKAGE is an Elixir package."
> +  (string-prefix? %elixir-prefix (package-name package)))
> +
> +(define (erlang-or-elixir-pkg? package)
> +  "Tell whether PACKAGE is an Elixir or an Erlang package."
> +  (or (erlang-package? package)
> +      (elixir-package? package)))
You can simplify these five variables into one to three (three being
quite many already depending on whether you'll actually use the smaller
ones).

> +(define (erlang-or-elixir-input? input)
> +  "Tell whether INPUT is an Elixir or an Erlang input."
> +  (match input
> +    ((_ package)
> +     (erlang-or-elixir-pkg? package))))
Skip.

> +(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.

> +;; A number of environment variables specific to the Mix build
> system are reflected here.
> +;; They are documented here:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables.
> +;; Other parameters located in mix.exs are defined here:
> +;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration
> +(define* (mix-build name
> +                    inputs
> +                    #:key
> +                    source
> +                    elixir-X.Y ;The major and minor of Elixir.
> +                    (tests? #t)
> +                    (mix-path #f) ;See MIX_PATH.
> +                    (mix-exs "mix.exs") ;See MIX_EXS.
> +                    (build-per-environment #t) ;See
> :build_per_environment.
> +                    (phases '%standard-phases)
> +                    (outputs '("out"))
> +                    (search-paths '())
> +                    (system (%current-system))
> +                    (guile #f)
> +                    (imported-modules imported-modules)
> +                    (modules modules))
> +  "Build SOURCE using Elixir, and with INPUTS."
> +
> +  ;; Check the documentation of :build_per_environment here:
> +  ;;
> https://hexdocs.pm/mix/1.15.7/Mix.Project.html#module-configuration A
> nd
> +  ;; "Environments" here:
> +  ;; https://hexdocs.pm/mix/1.15.7/Mix.html#module-environments
> +  (define mix-environments
> +    (if build-per-environment
> +        `("prod" ,@(if tests? '("test") '()))
> +        '("shared")))
> +
> +  (define builder
> +    (with-imported-modules imported-modules
> +      #~(begin
> +
> +          (use-modules #$@(sexp->gexp modules))
> +
> +          #$(with-build-variables inputs outputs
> +              #~(mix-build #:name #$name
> +                           #:source #+source
> +                           #:system #$system
> +                           #:tests? #$tests?
> +                           #:mix-path #$mix-path
> +                           #:mix-exs #$mix-exs
> +                           #:elixir-X.Y #$elixir-X.Y
> +                           #:mix-environments '#$mix-environments
> +                           #:build-per-environment #$build-per-
> environment
> +                           #:phases #$(if (pair? phases)
> +                                          (sexp->gexp phases)
> +                                          phases)
> +                           #:outputs %outputs
> +                           #:search-paths '#$(sexp->gexp
> +                                              (map
> +                                               search-path-
> specification->sexp
> +                                               search-paths))
> +                           #:inputs
> +                           %build-inputs)))))
> +
> +  (mlet %store-monad ((guile (package->derivation (or guile
> (default-guile))
> +                                                  system
> +                                                  #:graft? #f)))
> +    (gexp->derivation name
> +                      builder
> +                      #:system system
> +                      #:graft? #f       ;consistent with 'gnu-build'
> +                      #:target #f
> +                      #:guile-for-build guile)))
> +
> +(define* (lower name
> +                #:key
> +                source
> +                (inputs '())
> +                (tests? #t)
> +                (native-inputs '())
> +                (propagated-inputs '())
> +                outputs
> +                system
> +                target
> +                (elixir (default-elixir))
> +                #:allow-other-keys #:rest arguments)
> +  "Return a bag for NAME."
> +  (define private-keywords
> +    '(#:inputs #:native-inputs #:outputs #:system #:target
> #:elixir))
> +
> +  ;; Libraries are compiled using a given version of Elixir. This
> fact is
> +  ;; encoded by the name of a sub-directory like lib/elixir/X.Y. We
> compute
> +  ;; the value of X.Y here which is valid for the whole build.
> +  (define elixir-X.Y (version-major+minor (package-version elixir)))
> +
> +  ;; Elixir depends on a specific version of Erlang, this one.
> +  (define erlang (lookup-package-input elixir "erlang"))
> +
> +  ;; For mix to compile and test a package, it needs to find all
> inputs,
> +  ;; native-inputs and propagated-inputs (including the transitive
> ones) under
> +  ;; _build directories like _build/prod/lib.
> +  ;;
> +  ;; Given inputs and native-inputs of the package, we need to
> compute the
> +  ;; transitive closure of all Erlang and Elixir propagated inputs
> and add
> +  ;; them to the build inputs.
> +  (define all-propagated-inputs
> +    ((compose
> +      (cut delete-duplicates <> input=?)
> +      (cut filter erlang-or-elixir-input? <>)
> +      (cut append-map package-transitive-propagated-inputs <>)
> +      (cut map cadr <>))
> +     (append inputs native-inputs)))
> +
> +  (define build-inputs
> +    `(,@(standard-packages)
> +      ("glibc-utf8-locales" ,glibc-utf8-locales)
> +      ("erlang" ,erlang)
> +      ("rebar3" ,rebar3)
> +      ("elixir" ,elixir)
> +      ("elixir-hex" ,elixir-hex)
> +      ,@all-propagated-inputs
> +      ,@inputs
> +      ,@native-inputs))
> +
> +  ;; Some inputs, such as C programs, may be architecture dependent.
> +  (define host-inputs (if target inputs '()))
> +
> +  (bag (name name)
> +       (system system)
> +       (build-inputs build-inputs)
> +       (host-inputs host-inputs)
> +       (outputs outputs)
> +       (build mix-build)
> +       (arguments (append `(#:elixir-X.Y ,elixir-X.Y)
> +                          (strip-keyword-arguments private-keywords
> arguments)))))
> +
> +(define mix-build-system
> +  (build-system (name 'mix)
> +                (description "The standard Mix build system")
> +                (lower lower)))
> +
> +;;; mix.scm ends here
> diff --git a/guix/build/mix-build-system.scm b/guix/build/mix-build-
> system.scm
> new file mode 100644
> index 00000000..86a5db51
> --- /dev/null
> +++ b/guix/build/mix-build-system.scm
> @@ -0,0 +1,303 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2023 Pierre-Henry Fröhring
> <phfrohring@deeplinks.com>
> +;;;
> +;;; This file is part of GNU Guix.
> +;;;
> +;;; GNU Guix is free software; you can redistribute it and/or modify
> it
> +;;; under the terms of the GNU General Public License as published
> by
> +;;; the Free Software Foundation; either version 3 of the License,
> or (at
> +;;; your option) any later version.
> +;;;
> +;;; GNU Guix is distributed in the hope that it will be useful, but
> +;;; WITHOUT ANY WARRANTY; without even the implied warranty of
> +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +;;; GNU General Public License for more details.
> +;;;
> +;;; You should have received a copy of the GNU General Public
> License
> +;;; along with GNU Guix.  If not, see
> <http://www.gnu.org/licenses/>.
> +
> +;; Commentary:
> +;;
> +;; Code:
> +
> +(define-module (guix build mix-build-system)
> +  #:use-module ((guix build gnu-build-system) #:prefix gnu:)
> +  #:use-module (guix build utils)
> +  #:use-module (ice-9 ftw)
> +  #:use-module (ice-9 match)
> +  #:use-module (ice-9 regex)
> +  #:use-module (ice-9 string-fun)
> +  #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-26)
> +  #:export (mix-build
> +            strip-elixir-prefix
> +            %standard-phases))
> +
> +(define (f-join . paths)
> +  "Return a path (a string) formed from joining each component in
> PATHS (list of strings).
> +Example: \"a\" \"b\" \"c\" → \"a/b/c\""
> +  (string-join paths file-name-separator-string))
It is wiser to write these out as regular string-appends.

> +(define (strip-prefix prefix name)
> +  "Return NAME without the prefix PREFIX."
> +  (if (string-prefix? prefix name)
> +      (string-drop name (string-length prefix))
> +      name))
I'm pretty sure we have a function looking like this somewhere, but I
can't recall its name atm.  

> +;; All Elixir package names start with this prefix. If a package
> name starts
> +;; with this prefix, then it is an Elixir package.
> +(define %elixir-prefix "elixir-")
Useless magic constant.
> +
> +(define (path->elixir-lib path X.Y)
> +  "Return the path to the directory within PATH where libraries of
> an Elixir
> +package are installed. Here, X.Y represents the major and minor
> version
> +numbers of Elixir used for compilation."
> +  (f-join path "lib" "elixir" X.Y))
Is path itself ever useful here or does it simply point to the store?
This can likely be simplified to 
(define (elixir-lib version)
  (string-append "/lib/elixir/" version))

> +(define (elixir-name? name)
> +  "Determines if NAME is the name or the label associated to an
> Elixir
> +package."
> +  (string-prefix? %elixir-prefix name))
Useless use of magic constant.
> +
> +(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.

> +(define (strip-elixir-prefix name)
> +  "Strip %elixir-prefix from NAME."
> +  (strip-prefix %elixir-prefix name))
> 
> +;; All Erlang package names start with this prefix. If a package
> name starts
> +;; with this prefix, then it is an Erlang package.
> +(define %erlang-prefix "erlang-")
> +
> +(define (path->erlang-lib path)
> +  "Return the path of the directory where libraries of an Erlang
> package are
> +installed in the store."
> +  (f-join path "lib" "erlang" "lib"))
> +
> +(define (erlang-name? name)
> +  "Determines if NAME is the name or the label associated to an
> Erlang
> +package."
> +  (string-prefix? %erlang-prefix name))
> +
> +(define (erlang-input? input)
> +  "Determines if the given INPUT is an Erlang input."
> +  (match input
> +    ((label . path)
> +     ;; XXX: one condition may be enough. Without the first one, the
> erlang
> +     ;; input is considered an input when we just want Erlang
> packages.
> +     (and (erlang-name? label)
> +          (directory-exists? (path->erlang-lib path))))))
> +
> +(define (strip-erlang-prefix name)
> +  "Strip %erlang-prefix from NAME."
> +  (strip-prefix %erlang-prefix name))
Duplicated boilerplate for neither fun nor profit.

> +(define (erlang-or-elixir-input? X.Y input)
> +  "Determines if the given INPUT is an Erlang or Elixir input."
> +  (or (erlang-input? input)
> +      (elixir-input? X.Y input)))
Leak, leak, leak.
> +
> +(define (snakecase-name name)
> +  "Return a snakecase version of NAME."
> +  (string-replace-substring (string-downcase name) "-" "_"))
> +
> +(define (label->library-name label)
> +  "Return the library name associated to an input label LABEL."
> +  (define stripped-label
> +    (cond
> +     ((erlang-name? label)
> +      (strip-erlang-prefix label))
> +     ((elixir-name? label)
> +      (strip-elixir-prefix label))
> +     (#t (error "Invalid label: expected an Erlang or Elixir label."
> 'label label))))
> +  (snakecase-name stripped-label))
Don't rely on labels.

> +(define (pkg-name->library-name name)
> +  "Return the name of the library deduced from the name of the Guix
> package.
> +Example: elixir-a-pkg-1.0.2 → a_pkg
> +See: https://www.erlang.org/doc/man/code#code-path"
> +  ((compose
> +    label->library-name
> +    (cut string-join <> "-")
> +    (cut drop-right <> 1)
> +    (cut string-split <> #\-))
> +   name))
> +
> +;; We fix as many variables as possible.
> +;; See:
> https://hexdocs.pm/mix/1.15.7/Mix.html#module-environment-variables
> +(define MIX_HOME "MIX_HOME")
> +
> +(define MIX_ARCHIVES "MIX_ARCHIVES")
> +(define (%mix-archives mix-home) (f-join mix-home "archives"))
> +(define MIX_BUILD_ROOT "MIX_BUILD_ROOT")
> +(define %mix-build-root "_build")
> +(define MIX_DEPS_PATH "MIX_DEPS_PATH")
> +(define %mix-deps-path "deps")
> +(define MIX_PATH "MIX_PATH")
> +(define MIX_REBAR3 "MIX_REBAR3")
> +(define MIX_EXS "MIX_EXS")
> +(define %mix-exs "mix.exs")
> +;; XXX: if different architecture are needed, then use this
> variable.
> +(define MIX_TARGET "MIX_TARGET")
> +(define MIX_ENV "MIX_ENV")
> +(define %mix-env-prod "prod")
> +(define %mix-env-test "test")
> +(define %mix-env-shared "shared")
Gratuitous definitions are gratuitous.

> +;; The name of the directory where compiled libraries by mix are
> stored.
> +(define %mix-lib "lib")
> +
> +;; Useful because Elixir expects a UTF-8 locale.
> +(define LC_ALL "LC_ALL")
> +
> +(define (mix-build-dir mix-env)
> +  "Return the directory where build artifacts are to be installed
> according to
> +en environment MIX-ENV in the current directory."
> +  (f-join %mix-build-root mix-env %mix-lib))
> +
> +(define* (unpack #:key source mix-path #:allow-other-keys)
> +  "Unpack SOURCE in the working directory, and change directory
> within the
> +source.  When SOURCE is a directory, copy it in a sub-directory of
> the current
> +working directory."
> +  (let ((gnu-unpack (assoc-ref gnu:%standard-phases 'unpack)))
> +    (gnu-unpack #:source source)
> +    (let ((contents "contents.tar.gz"))
> +      (when (file-exists? contents)
> +        (invoke "tar" "xvf" contents)))))
> +
> +(define* (configure #:key inputs mix-path mix-exs #:allow-other-
> keys)
> +  "Set environment variables."
> +  (setenv LC_ALL "en_US.UTF-8")
> +  (setenv MIX_HOME (getcwd))
> +  (setenv MIX_ARCHIVES (%mix-archives (getenv MIX_HOME)))
> +  (setenv MIX_BUILD_ROOT %mix-build-root)
> +  (setenv MIX_DEPS_PATH %mix-deps-path)
> +  (setenv MIX_PATH (or mix-path ""))
> +  (setenv MIX_REBAR3 (f-join (assoc-ref inputs "rebar3") "bin"
> "rebar3"))
> +  (setenv MIX_EXS mix-exs))
> +
> +(define* (install-hex #:key inputs name elixir-X.Y #:allow-other-
> keys)
> +  "Install Hex."
> +  (define hex-name "hex")
> +  (define hex-path (assoc-ref inputs "elixir-hex"))
> +  (define hex-lib (f-join (path->elixir-lib hex-path elixir-X.Y)
> hex-name))
> +  (define hex-archive-path (f-join (getenv MIX_ARCHIVES) hex-name))
> +  (mkdir-p hex-archive-path)
> +  (symlink hex-lib (f-join hex-archive-path hex-name)))
> +
> +(define* (install-dependencies #:key
> +                               name
> +                               tests?
> +                               build-per-environment
> +                               (inputs '())
> +                               (native-inputs '())
> +                               elixir-X.Y
> +                               mix-environments
> +                               #:allow-other-keys
> +                               #:rest rest)
> +  "Install dependencies.
> +Given an environment mix-env, we define all-inputs(mix-env) as the
> set of all
> +necessary Erlang and Elixir inputs and associated propagated inputs
> (and
> +transitive propagated inputs).
> +
> +For example, all-inputs(prod) represents all the Erlang and Elixir
> inputs and
> +propagated inputs necessary to compile the Mix project for the prod
> +environment.
> +
> +If dep belongs to all-inputs(mix-env) and its library name is dep-
> name, then
> +it is installed under (f-join (mix-build-dir mix-env) dep-name) as a
> symbolic
> +link."
The docstring divulges implementation details without really explaining
what the function itself does.  
> +  (define (all-inputs mix-env)
> +    (define env-inputs
> +      (cond
> +       ((string=? mix-env %mix-env-prod)
> +        inputs)
> +       ((member mix-env (list %mix-env-test %mix-env-shared))
> +        (append inputs native-inputs))
> +       (#t (error "Unexpected Mix environment." 'mix-env mix-env))))
You probably want and ice-9 match here, which has an implicit error on
failed matches.
> +    (filter (cut erlang-or-elixir-input? elixir-X.Y <>) env-inputs))
> +
> +  (define (install-input mix-env input)
> +    (let ((dir (mix-build-dir mix-env)))
> +      (mkdir-p dir)
> +      (match input
> +        ((label . path)
> +         (let ((lib-name (label->library-name label)))
> +           (symlink
> +            (f-join (path->elixir-lib path elixir-X.Y) lib-name)
> +            (f-join dir lib-name)))))))
> +
> +  (define (install-inputs mix-env)
> +    (for-each (cut install-input mix-env <>)
> +              (all-inputs mix-env)))
> +
> +  (for-each install-inputs mix-environments))
> +
> +(define* (build #:key mix-environments #:allow-other-keys)
> +  "Builds the Mix project."
> +  (define (compile mix-env)
> +    (setenv MIX_ENV mix-env)
> +    (invoke "mix" "compile" "--no-deps-check"))
> +  (for-each compile mix-environments))
> +
> +(define* (check #:key (tests? #t) #:allow-other-keys)
> +  "Test the Mix project."
> +  (if tests?
> +      (invoke "mix" "test" "--no-deps-check")
> +      (format #t "tests? = ~a~%" tests?)))
> +
> +(define* (remove-mix-dirs . _)
> +  "Remove all .mix/ directories.
> +We do not want to copy them to the installation directory."
> +  (define mix-dirs
> +    (find-files "."
> +                (file-name-predicate "\\.mix$")
> +                #:directories? #t))
> +  (for-each delete-file-recursively mix-dirs))
> +
> +(define* (install #:key
> +                  inputs
> +                  outputs
> +                  name
> +                  build-per-environment
> +                  elixir-X.Y
> +                  #:allow-other-keys)
> +  "Install build artifacts in the store."
> +  (define lib-name (pkg-name->library-name name))
> +
> +  (define dir-build
> +    (f-join (mix-build-dir (if build-per-environment %mix-env-prod
> %mix-env-shared))
> +            lib-name))
> +
> +  (define dir-install
> +    (f-join (path->elixir-lib (assoc-ref outputs "out") elixir-X.Y)
> +            lib-name))
> +  (mkdir-p dir-install)
> +
> +  (copy-recursively dir-build dir-install
> +                    #:follow-symlinks? #t))
> +
> +(define %standard-phases
> +  (modify-phases gnu:%standard-phases
> +    (delete 'bootstrap)
> +    (replace 'configure configure)
> +    (replace 'unpack unpack)
> +    (add-after 'patch-generated-file-shebangs 'install-hex install-
> hex)
> +    (add-after 'install-hex 'install-dependencies install-
> dependencies)
> +    (replace 'build build)
> +    (replace 'check check)
> +    (add-before 'install 'remove-mix-dirs remove-mix-dirs)
> +    (replace 'install install)))
> +
> +(define* (mix-build #:key inputs (phases %standard-phases)
> +                    #:allow-other-keys #:rest args)
> +  "Build the given Mix package, applying all of PHASES in order."
> +  (apply gnu:gnu-build #:inputs inputs #:phases phases args))
> +
> +;;; mix-build-system.scm ends here
> 
> base-commit: a0d337e79c87d7c38c79d0291974f490cb137a52
I probably missed some, but I think you get the gist.  While this isn't
exactly code golf, try to express yourself in terms of the least
verbose primitives and don't add meaningless layers of indirection – we
already have enough actual meaningful ones.

Cheers

  reply	other threads:[~2023-11-13 21:23 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-28 20:19 [bug#66801] [PATCH] mix-build-system: draft 1 Pierre-Henry Fröhring
2023-10-28 21:43 ` Liliana Marie Prikler
2023-10-29 17:19   ` Pierre-Henry Fröhring
2023-10-29 14:36 ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Pierre-Henry Fröhring
2023-10-29 14:36   ` [bug#66801] [PATCH va3e5ae0f..37252e07 02/32] gnu: erlang updated Pierre-Henry Fröhring
2023-10-29 19:22     ` Liliana Marie Prikler
2023-10-29 14:36   ` [bug#66801] [PATCH va3e5ae0f..37252e07 03/32] gnu: erlang-certifi: moved to erlang-xyz.scm Pierre-Henry Fröhring
2023-10-29 19:25     ` Liliana Marie Prikler
2023-10-29 14:36   ` [bug#66801] [PATCH va3e5ae0f..37252e07 04/32] gnu: erlang-getopt: " Pierre-Henry Fröhring
2023-10-29 14:36   ` [bug#66801] [PATCH va3e5ae0f..37252e07 05/32] gnu: erlang-edown: " Pierre-Henry Fröhring
2023-10-29 14:36   ` [bug#66801] [PATCH va3e5ae0f..37252e07 06/32] gnu: erlang-rebar3-git-vsn: " Pierre-Henry Fröhring
2023-10-29 19:31     ` Liliana Marie Prikler
2023-10-29 19:42       ` Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 07/32] gnu: erlang-rebar3-raw-deps: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 08/32] gnu: erlang-rebar3-proper: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 09/32] gnu: erlang-bbmustache: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 10/32] gnu: erlang-cf: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 11/32] gnu: erlang-yamerl: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 12/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 13/32] gnu: erlang-cth-readable: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 14/32] gnu: erlang-erlware-commons: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 15/32] gnu: erlang-eunit-formatters: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 16/32] gnu: erlang-proper: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 17/32] gnu: erlang-hex-core: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 18/32] gnu: erlang-jsx: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 19/32] gnu: erlang-relx: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 20/32] gnu: erlang-providers: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 21/32] gnu: erlang-jsone: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 22/32] gnu: erlang-parse-trans: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 23/32] gnu: erlang-unicode-util-compat: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 24/32] gnu: erlang-idna: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 25/32] gnu: erlang-bear: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 26/32] gnu: erlang-erlang-color: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 27/32] gnu: erlang-tdiff: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 28/32] gnu: erlang-rebar3-ex-doc: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 29/32] gnu: erlang-samovar: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 30/32] gnu: erlang-geas: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 31/32] gnu: erlang-covertool: " Pierre-Henry Fröhring
2023-10-29 14:37   ` [bug#66801] [PATCH va3e5ae0f..37252e07 32/32] gnu: erlang-telemetry: " Pierre-Henry Fröhring
2023-10-29 18:29   ` [bug#66801] [PATCH va3e5ae0f..37252e07 01/32] rebar-build-system and packages Liliana Marie Prikler
2023-10-29 22:14     ` Pierre-Henry Fröhring
2023-10-30  5:29       ` Liliana Marie Prikler
2023-10-30 12:30         ` Pierre-Henry Fröhring
2023-10-30 20:40           ` Liliana Marie Prikler
2023-11-08  9:21 ` [bug#66801] A minimal set of changes Pierre-Henry Fröhring
2023-11-08  9:22 ` [bug#66801] [PATCH 0/5] build Erlang packages with dependencies Pierre-Henry Fröhring
2023-11-08  9:22   ` [bug#66801] [PATCH 1/5] guix: build-system: rebar: " Pierre-Henry Fröhring
2023-11-08 20:40     ` Liliana Marie Prikler
2023-11-13 18:58       ` Pierre-Henry Fröhring
2023-11-08  9:22   ` [bug#66801] [PATCH 2/5] gnu: Add erlang-goldrush Pierre-Henry Fröhring
2023-11-08  9:22   ` [bug#66801] [PATCH 3/5] gnu: Add erlang-lager Pierre-Henry Fröhring
2023-11-08  9:22   ` [bug#66801] [PATCH 4/5] gnu: Add erlang-unicode-util-compat Pierre-Henry Fröhring
2023-11-08  9:22   ` [bug#66801] [PATCH 5/5] gnu: Add erlang-idna Pierre-Henry Fröhring
2023-11-13 20:26 ` [bug#66801] ['PATCH v2' 01/14] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-11-13 21:22   ` Liliana Marie Prikler [this message]
2023-11-14 10:37     ` Pierre-Henry Fröhring
2023-11-14 17:53       ` Liliana Marie Prikler
2023-11-15  9:57         ` Pierre-Henry Fröhring
2023-11-15  9:59           ` Pierre-Henry Fröhring
2023-11-15 12:40           ` [bug#66801] Fwd: " Pierre-Henry Fröhring
2023-11-15 18:36           ` [bug#66801] " Liliana Marie Prikler
2023-11-15 22:49             ` Pierre-Henry Fröhring
2023-11-15 22:51 ` [bug#66801] [PATCH v3 " Pierre-Henry Fröhring
2023-11-16  2:05   ` Liliana Marie Prikler
2023-11-16 13:01     ` Pierre-Henry Fröhring
2023-11-16 15:11       ` Liliana Marie Prikler
2023-11-16 18:12         ` Pierre-Henry Fröhring
2023-11-16 19:34           ` Liliana Marie Prikler
2023-11-17  7:36             ` Pierre-Henry Fröhring
2023-11-17  8:03 ` Pierre-Henry Fröhring
2023-11-17 19:24   ` Liliana Marie Prikler
2023-11-18  4:44     ` Pierre-Henry Fröhring
2023-11-18  7:12       ` Liliana Marie Prikler
2023-11-18 10:19         ` Pierre-Henry Fröhring
2023-11-18 11:11           ` Liliana Marie Prikler
2023-11-18 12:02             ` Pierre-Henry Fröhring
2023-12-07 22:34 ` [bug#66801] [PATCH] " Pierre-Henry Fröhring
2023-12-08  7:25   ` Liliana Marie Prikler
2023-12-08  8:01     ` Pierre-Henry Fröhring
2023-12-08  9:52       ` Liliana Marie Prikler
2023-12-08 10:17         ` Pierre-Henry Fröhring
2023-12-08 11:50           ` Liliana Marie Prikler
2023-12-08 14:20             ` Pierre-Henry Fröhring
2023-12-08 14:55               ` Liliana Marie Prikler
2023-12-08 11:10 ` [bug#66801] [PATCH 01/15] " Pierre-Henry Fröhring
2023-12-08 11:10   ` [bug#66801] [PATCH 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 11:10   ` [bug#66801] [PATCH 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-08 14:27 ` [bug#66801] [PATCH v3 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 14:27   ` [bug#66801] [PATCH v3 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 14:27   ` [bug#66801] [PATCH v3 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-08 15:29     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
2023-12-08 15:30     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
2023-12-08 15:30     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
2023-12-08 15:31     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
2023-12-08 15:33     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
2023-12-08 15:33     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
2023-12-08 15:35     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
2023-12-08 15:36     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
2023-12-08 15:38     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
2023-12-08 15:39     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
2023-12-08 15:39     ` Liliana Marie Prikler
2023-12-08 15:03   ` [bug#66801] [PATCH v3 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-08 15:03   ` [bug#66801] [PATCH v3 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
2023-12-08 15:40     ` Liliana Marie Prikler
2023-12-08 17:30       ` Pierre-Henry Fröhring
2023-12-08 18:01         ` Liliana Marie Prikler
2023-12-08 18:19           ` Pierre-Henry Fröhring
2023-12-08 18:35 ` [bug#66801] [PATCH v4 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-08 18:35   ` [bug#66801] [PATCH v4 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
2023-12-10 12:34 ` [bug#66801] (no subject) Pierre-Henry Fröhring
2023-12-10 13:03 ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Pierre-Henry Fröhring
2023-12-10 13:03   ` [bug#66801] [PATCH v5 02/15] gnu: elixir: Wrap binaries Pierre-Henry Fröhring
2023-12-10 13:03   ` [bug#66801] [PATCH v5 03/15] gnu: Add elixir-hex Pierre-Henry Fröhring
2023-12-10 13:03   ` [bug#66801] [PATCH v5 04/15] gnu: Add elixir-nimble-parsec Pierre-Henry Fröhring
2023-12-10 13:03   ` [bug#66801] [PATCH v5 05/15] gnu: Add elixir-makeup Pierre-Henry Fröhring
2023-12-10 13:03   ` [bug#66801] [PATCH v5 06/15] gnu: Add elixir-jason Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 07/15] gnu: Add elixir-file-system Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 08/15] gnu: Add elixir-bunt Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 09/15] gnu: Add elixir-inch-ex Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 10/15] gnu: Add elixir-castore Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 11/15] gnu: Add elixir-excoveralls Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 12/15] gnu: Add elixir-credo Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 13/15] gnu: Add elixir-erlex Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 14/15] gnu: Add elixir-dialyxir Pierre-Henry Fröhring
2023-12-10 13:04   ` [bug#66801] [PATCH v5 15/15] gnu: Add elixir-machete Pierre-Henry Fröhring
2023-12-10 14:20   ` [bug#66801] [PATCH v5 01/15] build-system: Add mix-build-system Liliana Marie Prikler
2023-12-10 14:22     ` Pierre-Henry Fröhring
2023-12-18  3:01       ` bug#66801: " Liliana Marie Prikler
2023-12-10 13:05 ` [bug#66801] Erratum Pierre-Henry Fröhring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dff0d773a3d24e50760ff49d79dea1b1599d4ec5.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=66801@debbugs.gnu.org \
    --cc=phfrohring@deeplinks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.