[PATCH 00/48] Extend bag-build to gexps.

  • Open
  • quality assurance status badge
Details
One participant
  • Nicolas Graves
Owner
unassigned
Submitted by
Nicolas Graves
Severity
normal
N
N
Nicolas Graves wrote on 8 Jan 09:00 +0100
[PATCH 00/48] Extend bag-build to gexps.
(address . guix-patches@gnu.org)(address . ngraves@ngraves.fr)
20240108080048.25026-1-ngraves@ngraves.fr
Rationale:
Almost all build-systems are defined with gexpressions in functions
that return derivations. Derivations are not easily extensible while
gexps are. An example usage is given below.

This is a pretty big rewrite that should recompile almost all packages,
but a lot of grafting happens such as I could rebuild my system quickly.

I was trying to get the build-phases of an existing package to apply to
a local repository, because guix as a development tool for heavy packages
(emacs, ungoogled-chromium) is tedious, and there are precious info in
build-phases that can be applied in a local repository. I'm not aware of
prior work on this particular issue.

These patches allow to do extensions such as:

(build-system
(name 'local-gnu)
(description "GNU Build System applied in the current directory")
(lower
(lambda* args
(let ((old-bag (apply
(build-system-lower
(package-build-system emacs-pgtk))
args)))
(bag
(inherit old-bag)
(build
(lambda* build-args
(mlet %store-monad
((builder (apply (bag-build old-bag) build-args)))
(return (with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
(with-directory-excursion #$(getcwd)
#$builder))))))))))))

Of course this type of build-system isn't directly applicable because of
the chroot of the builder, but this other trick makes it happen :

;; We can't use package->derivation directly because we want the user rather
;; than the daemon to build the derivation.
(with-store store
(run-with-store store
(mlet* %store-monad ((bag -> (package->bag pkg))
(drv (bag->derivation bag pkg)))
;; ensure inputs are in the store.
(built-derivations (derivation-inputs drv))
(with-environment-excursion
(apply invoke (derivation-builder (pk 'd drv))
(derivation-builder-arguments drv))))))

This isn't polished yet, but could serve as an handy way to develop
heavy packages locally while taking advantage of the code that's
already in guix build phases.


Nicolas Graves (48):
guix: packages: Extend bag-build to support gexp.
build-system: gnu: Improve gnu-cross-build style.
build-system: gnu: Redefine gnu-build and gnu-cross-build.
build-system: agda: Redefine agda-build.
build-system: android-ndk: Redefine gnu-build.
build-system: ant: Redefine ant-build.
build-system: asdf: Redefine asdf-build.
build-system: cargo: Redefine cargo-build and cargo-cross-build.
build-system: chicken: Redefine chicken-build.
build-system: clojure: Redefine clojure-build.
build-system: cmake: Redefine cmake-build and cmake-cross-build.
build-system: composer: Redefine composer-build.
build-system: copy: Redefine copy-build.
build-system: dub: Redefine dub-build.
build-system: dune: Redefine dune-build.
build-system: elm: Redefine elm-build.
build-system: emacs: Redefine emacs-build.
build-system: font: Redefine font-build.
build-system: glib-or-gtk: Improve glib-or-gtk-cross-build style.
build-system: glib-or-gtk: Redefine glib-or-gtk-build functions.
build-system: go: Redefine go-build and go-cross-build.
build-system: guile: Redefine guile-build and guile-cross-build.
build-system: haskell: Redefine haskell-build.
build-system: julia: Redefine julia-build.
build-system: linux-module: Redefine linux-module-build functions.
build-system: maven: Redefine maven-build.
build-system: meson: Redefine meson-build and meson-cross-build.
build-system: minify: Redefine minify-build.
build-system: mix: Redefine mix-build.
build-system: node: Redefine node-build.
build-system: ocaml: Redefine ocaml-build.
build-system: perl: Redefine perl-build and perl-cross-build.
build-system: pyproject: Redefine pyproject-build.
build-system: python: Redefine python-build.
build-system: qt: Redefine qt-build and qt-cross-build.
build-system: r: Redefine r-build.
build-system: rakudo: Redefine rakudo-build.
build-system: rebar: Redefine rebar-build.
build-system: renpy: Redefine renpy-build.
build-system: ruby: Improve ruby-cross-build style.
build-system: ruby: Redefine ruby-build.
build-system: scons: Redefine scons-build.
build-system: texlive: Redefine texlive-build.
build-system: tree-sitter: Redefine tree-sitter-build functions.
build-system: vim: Redefine vim-build.
build-system: waf: Improve waf-build style.
build-system: zig: Redefine zig-build.
build-system: trivial: Redefine trivial-build functions.

guix/build-system.scm | 2 +-
guix/build-system/agda.scm | 8 +-
guix/build-system/android-ndk.scm | 8 +-
guix/build-system/ant.scm | 8 +-
guix/build-system/asdf.scm | 8 +-
guix/build-system/cargo.scm | 19 ++---
guix/build-system/chicken.scm | 8 +-
guix/build-system/clojure.scm | 8 +-
guix/build-system/cmake.scm | 24 ++----
guix/build-system/composer.scm | 9 +--
guix/build-system/copy.scm | 11 +--
guix/build-system/dub.scm | 8 +-
guix/build-system/dune.scm | 9 +--
guix/build-system/elm.scm | 8 +-
guix/build-system/emacs.scm | 8 +-
guix/build-system/font.scm | 10 +--
guix/build-system/glib-or-gtk.scm | 115 ++++++++++++----------------
guix/build-system/gnu.scm | 119 +++++++++++++----------------
guix/build-system/go.scm | 20 ++---
guix/build-system/guile.scm | 21 ++---
guix/build-system/haskell.scm | 8 +-
guix/build-system/julia.scm | 8 +-
guix/build-system/linux-module.scm | 17 ++---
guix/build-system/maven.scm | 8 +-
guix/build-system/meson.scm | 25 ++----
guix/build-system/minify.scm | 8 +-
guix/build-system/mix.scm | 12 +--
guix/build-system/node.scm | 8 +-
guix/build-system/ocaml.scm | 9 +--
guix/build-system/perl.scm | 22 ++----
guix/build-system/pyproject.scm | 13 +---
guix/build-system/python.scm | 12 +--
guix/build-system/qt.scm | 17 ++---
guix/build-system/r.scm | 9 +--
guix/build-system/rakudo.scm | 8 +-
guix/build-system/rebar.scm | 12 +--
guix/build-system/renpy.scm | 8 +-
guix/build-system/ruby.scm | 48 ++++++------
guix/build-system/scons.scm | 9 +--
guix/build-system/texlive.scm | 11 +--
guix/build-system/tree-sitter.scm | 16 ++--
guix/build-system/trivial.scm | 41 ++++------
guix/build-system/vim.scm | 15 +---
guix/build-system/waf.scm | 32 ++++----
guix/build-system/zig.scm | 8 +-
guix/packages.scm | 53 ++++++++++---
46 files changed, 348 insertions(+), 520 deletions(-)

--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 01/48] guix: packages: Extend bag-build to support gexp.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-1-ngraves@ngraves.fr
* guix/build-system.scm: Update comment.
* guix/packages.scm
(bag->derivation): Rename function to bag-builder. Create new function.
(bag->cross-derivation): Rename to bag-cross-builder.

Change-Id: I56c5a9dab9954307f95b29eab5e02ee058271684
---
guix/build-system.scm | 2 +-
guix/packages.scm | 53 +++++++++++++++++++++++++++++++++++--------
2 files changed, 45 insertions(+), 10 deletions(-)

Toggle diff (108 lines)
diff --git a/guix/build-system.scm b/guix/build-system.scm
index 76d670995c..a4dcdc52d8 100644
--- a/guix/build-system.scm
+++ b/guix/build-system.scm
@@ -79,7 +79,7 @@ (define-record-type* <bag> bag %make-bag
(default '("out")))
(arguments bag-arguments ;list
(default '()))
- (build bag-build)) ;bag -> derivation
+ (build bag-build)) ;bag -> gexp or derivation
(define* (make-bag build-system name
#:key source (inputs '()) (native-inputs '())
diff --git a/guix/packages.scm b/guix/packages.scm
index 930b1a3b0e..8ff9ca60a9 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -50,6 +51,7 @@ (define-module (guix packages)
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
#:use-module (ice-9 regex)
+ #:use-module (ice-9 optargs)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9 gnu)
#:use-module (srfi srfi-26)
@@ -1889,12 +1891,12 @@ (define (input=? input1 input2)
(derivation=? obj1 obj2))
(equal? obj1 obj2))))))))
-(define* (bag->derivation bag #:optional context)
- "Return the derivation to build BAG for SYSTEM. Optionally, CONTEXT can be
-a package object describing the context in which the call occurs, for improved
-error reporting."
+(define* (bag-builder bag #:optional context)
+ "Return the gexp or derivation to build BAG for SYSTEM. Optionally, CONTEXT
+can be a package object describing the context in which the call occurs, for
+improved error reporting."
(if (bag-target bag)
- (bag->cross-derivation bag)
+ (bag-cross-builder bag)
(mlet* %store-monad ((system -> (bag-system bag))
(inputs -> (bag-transitive-inputs bag))
(input-drvs (mapm %store-monad
@@ -1916,10 +1918,10 @@ (define* (bag->derivation bag #:optional context)
#:outputs (bag-outputs bag) #:system system
(bag-arguments bag)))))
-(define* (bag->cross-derivation bag #:optional context)
- "Return the derivation to build BAG, which is actually a cross build.
-Optionally, CONTEXT can be a package object denoting the context of the call.
-This is an internal procedure."
+(define* (bag-cross-builder bag #:optional context)
+ "Return the gexp or derivation to build BAG, which is actually a cross
+build. Optionally, CONTEXT can be a package object denoting the context of the
+call. This is an internal procedure."
(mlet* %store-monad ((system -> (bag-system bag))
(target -> (bag-target bag))
(host -> (bag-transitive-host-inputs bag))
@@ -1960,6 +1962,39 @@ (define* (bag->cross-derivation bag #:optional context)
#:system system #:target target
(bag-arguments bag))))
+(define* (bag->derivation bag #:optional context)
+ "Return the derivation to build BAG for SYSTEM. Optionally, CONTEXT can be
+a package object describing the context in which the call occurs, for improved
+error reporting."
+ (mlet %store-monad ((builder (bag-builder bag context)))
+ (match builder
+ ((? derivation? drv)
+ (return drv))
+ ((? gexp gexp)
+ (let-keywords (bag-arguments bag) #t
+ ((allowed-references #f)
+ (disallowed-references #f)
+ (guile #f)
+ (substitutable? #t))
+ (mlet %store-monad
+ ((guile (package->derivation (or guile (default-guile))
+ (bag-system bag)
+ #:graft? #f)))
+ ;; Note: Always pass #:graft? #f. Without it, ALLOWED-REFERENCES &
+ ;; co. would be interpreted as referring to grafted packages.
+ (gexp->derivation (bag-name bag) gexp
+ #:system (bag-system bag)
+ #:target (and (bag-target bag))
+ #:graft? #f
+ #:substitutable? substitutable?
+ #:allowed-references allowed-references
+ #:disallowed-references disallowed-references
+ #:guile-for-build guile))))
+ ;; build-bag has to be drv or gexp, else raise.
+ (_
+ (raise (condition (&package-error
+ (package context))))))))
+
(define bag->derivation*
(store-lower bag->derivation))
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 02/48] build-system: gnu: Improve gnu-cross-build style.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-2-ngraves@ngraves.fr
* guix/build-system/gnu.scm
(gnu-cross-build): Use with-imported-modules around the
gnu-cross-build builder gexp.

Change-Id: I47246571b1d84a82a67a8c289fd5ad4b5a3b5aeb
---
guix/build-system/gnu.scm | 93 ++++++++++++++++++++-------------------
1 file changed, 47 insertions(+), 46 deletions(-)

Toggle diff (124 lines)
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index cdbb547773..c3de5c2544 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -511,56 +512,57 @@ (define* (gnu-cross-build name
cross-built inputs, and NATIVE-INPUTS are inputs that run on the build
platform."
(define builder
- #~(begin
- (use-modules #$@(sexp->gexp modules))
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
- (define %build-host-inputs
- #+(input-tuples->gexp build-inputs))
+ (define %build-host-inputs
+ #+(input-tuples->gexp build-inputs))
- (define %build-target-inputs
- (append #$(input-tuples->gexp host-inputs)
- #+(input-tuples->gexp target-inputs)))
+ (define %build-target-inputs
+ (append #$(input-tuples->gexp host-inputs)
+ #+(input-tuples->gexp target-inputs)))
- (define %build-inputs
- (append %build-host-inputs %build-target-inputs))
+ (define %build-inputs
+ (append %build-host-inputs %build-target-inputs))
- (define %outputs
- #$(outputs->gexp outputs))
+ (define %outputs
+ #$(outputs->gexp outputs))
- (gnu-build #:source #+source
- #:system #$system
- #:build #$build
- #:target #$target
- #:outputs %outputs
- #:inputs %build-target-inputs
- #:native-inputs %build-host-inputs
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:native-search-paths '#$(sexp->gexp
- (map
- search-path-specification->sexp
- native-search-paths))
- #:phases #$(if (pair? phases)
- (sexp->gexp phases)
- phases)
- #:locale #$locale
- #:bootstrap-scripts #$bootstrap-scripts
- #:configure-flags #$configure-flags
- #:make-flags #$make-flags
- #:out-of-source? #$out-of-source?
- #:tests? #$tests?
- #:test-target #$test-target
- #:parallel-build? #$parallel-build?
- #:parallel-tests? #$parallel-tests?
- #:patch-shebangs? #$patch-shebangs?
- #:license-file-regexp #$license-file-regexp
- #:strip-binaries? #$strip-binaries?
- #:validate-runpath? #$validate-runpath?
- #:make-dynamic-linker-cache? #$make-dynamic-linker-cache?
- #:license-file-regexp #$license-file-regexp
- #:strip-flags #$strip-flags
- #:strip-directories #$strip-directories)))
+ (gnu-build #:source #+source
+ #:system #$system
+ #:build #$build
+ #:target #$target
+ #:outputs %outputs
+ #:inputs %build-target-inputs
+ #:native-inputs %build-host-inputs
+ #:search-paths '#$(sexp->gexp
+ (map search-path-specification->sexp
+ search-paths))
+ #:native-search-paths '#$(sexp->gexp
+ (map
+ search-path-specification->sexp
+ native-search-paths))
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:locale #$locale
+ #:bootstrap-scripts #$bootstrap-scripts
+ #:configure-flags #$configure-flags
+ #:make-flags #$make-flags
+ #:out-of-source? #$out-of-source?
+ #:tests? #$tests?
+ #:test-target #$test-target
+ #:parallel-build? #$parallel-build?
+ #:parallel-tests? #$parallel-tests?
+ #:patch-shebangs? #$patch-shebangs?
+ #:license-file-regexp #$license-file-regexp
+ #:strip-binaries? #$strip-binaries?
+ #:validate-runpath? #$validate-runpath?
+ #:make-dynamic-linker-cache? #$make-dynamic-linker-cache?
+ #:license-file-regexp #$license-file-regexp
+ #:strip-flags #$strip-flags
+ #:strip-directories #$strip-directories))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))
@@ -568,7 +570,6 @@ (define %outputs
#:system system
#:target target
#:graft? #f
- #:modules imported-modules
#:substitutable? substitutable?
#:allowed-references allowed-references
#:disallowed-references disallowed-references
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 03/48] build-system: gnu: Redefine gnu-build and gnu-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-3-ngraves@ngraves.fr
* guix/build-system/gnu.scm
(gnu-build): Monadic procedure returns a gexp instead of a derivation.
(gnu-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I6bf922ecd1474df104f959989db315d7ddc278b6
---
guix/build-system/gnu.scm | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)

Toggle diff (46 lines)
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index c3de5c2544..f753aeea28 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -421,18 +421,8 @@ (define builder
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- ;; Note: Always pass #:graft? #f. Without it, ALLOWED-REFERENCES &
- ;; co. would be interpreted as referring to grafted packages.
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:substitutable? substitutable?
- #:allowed-references allowed-references
- #:disallowed-references disallowed-references
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
;;;
@@ -564,16 +554,8 @@ (define %outputs
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #f
- #:substitutable? substitutable?
- #:allowed-references allowed-references
- #:disallowed-references disallowed-references
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define gnu-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 04/48] build-system: agda: Redefine agda-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-4-ngraves@ngraves.fr
* guix/build-system/agda.scm
(agda-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I3c21a043a0687f4776d44297ed3dd4697a606b40
---
guix/build-system/agda.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (27 lines)
diff --git a/guix/build-system/agda.scm b/guix/build-system/agda.scm
index 64983dff60..b76c72ef44 100644
--- a/guix/build-system/agda.scm
+++ b/guix/build-system/agda.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Josselin Poiret <dev@jpoiret.xyz>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -109,11 +110,8 @@ (define builder
#:plan '#$plan
#:extra-files '#$extra-files))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define agda-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 05/48] build-system: android-ndk: Redefine gnu-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-5-ngraves@ngraves.fr
* guix/build-system/android-ndk.scm
(android-ndk-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: If1737d77ebccd418ad461c91aff170273855ed45
---
guix/build-system/android-ndk.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/android-ndk.scm b/guix/build-system/android-ndk.scm
index aa7cc06279..cee5d6674d 100644
--- a/guix/build-system/android-ndk.scm
+++ b/guix/build-system/android-ndk.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -73,11 +74,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (lower name
#:key source inputs native-inputs outputs system target
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 06/48] build-system: ant: Redefine ant-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-6-ngraves@ngraves.fr
* guix/build-system/ant.scm
(ant-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I4f1152e29b938dbf37125bf156fb56b841011f06
---
guix/build-system/ant.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm
index 84bf951fab..4e04737dda 100644
--- a/guix/build-system/ant.scm
+++ b/guix/build-system/ant.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -144,11 +145,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define ant-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 07/48] build-system: asdf: Redefine asdf-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-7-ngraves@ngraves.fr
* guix/build-system/asdf.scm
(asdf-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ifdd57c4e5279d110ee7c670090b3ae4089703659
---
guix/build-system/asdf.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm
index 2b17cee37b..4ee951e70f 100644
--- a/guix/build-system/asdf.scm
+++ b/guix/build-system/asdf.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2019, 2020, 2021, 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -318,11 +319,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs))))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile))))
+ (mbegin %store-monad
+ (return builder))))
(define asdf-build-system/sbcl
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 08/48] build-system: cargo: Redefine cargo-build and cargo-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-8-ngraves@ngraves.fr
* guix/build-system/cargo.scm
(cargo-build): Monadic procedure returns a gexp instead of a derivation.
(cargo-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: If1151e9222170f2eb3a92d43debc61c696c2e72d
---
guix/build-system/cargo.scm | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

Toggle diff (47 lines)
diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index c029cc1dda..8576aeaf59 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
;;; Copyright © 2020 Jakub K?dzio?ka <kuba@kadziolka.net>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -126,11 +127,8 @@ (define builder
(map search-path-specification->sexp
search-paths))))))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile))
+ (mbegin %store-monad
+ (return builder)))
(define* (cargo-cross-build name
#:key
@@ -186,14 +184,11 @@ (define builder
(map search-path-specification->sexp
search-paths))
#:native-search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- native-search-paths))))))
+ (map search-path-specification->sexp
+ native-search-paths))))))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #f
- #:guile-for-build guile))
+ (mbegin %store-monad
+ (return builder)))
(define (package-cargo-inputs p)
(apply
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 09/48] build-system: chicken: Redefine chicken-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-9-ngraves@ngraves.fr
* guix/build-system/chicken.scm
(chicken-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I6a837f198ac6c371b08f8690ff5bea68dbad2b54
---
guix/build-system/chicken.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/chicken.scm b/guix/build-system/chicken.scm
index 9f518e66e6..d305db8e7f 100644
--- a/guix/build-system/chicken.scm
+++ b/guix/build-system/chicken.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2020 raingloom <raingloom@riseup.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -113,11 +114,8 @@ (define builder
#:tests? #$tests?
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define chicken-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 10/48] build-system: clojure: Redefine clojure-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-10-ngraves@ngraves.fr
* guix/build-system/clojure.scm
(clojure-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I5b5b552052cfffc45bc4d82871600b322eb23d85
---
guix/build-system/clojure.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/clojure.scm b/guix/build-system/clojure.scm
index 037fcaf21d..cddcf8304e 100644
--- a/guix/build-system/clojure.scm
+++ b/guix/build-system/clojure.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -169,11 +170,8 @@ (define builder
#:system #$system
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define clojure-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 12/48] build-system: composer: Redefine composer-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-12-ngraves@ngraves.fr
* guix/build-system/composer.scm
(composer-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ib7787a5116744e61e3d0afeac6d85f61c6b6c9c4
---
guix/build-system/composer.scm | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

Toggle diff (35 lines)
diff --git a/guix/build-system/composer.scm b/guix/build-system/composer.scm
index 2ad7bbb36a..f8fafe778e 100644
--- a/guix/build-system/composer.scm
+++ b/guix/build-system/composer.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;; Copyright © 2023-2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -18,6 +19,7 @@
(define-module (guix build-system composer)
#:use-module (guix store)
+ #:use-module (guix monads)
#:use-module (guix utils)
#:use-module (guix derivations)
#:use-module (guix search-paths)
@@ -151,11 +153,8 @@ (define builder
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile))
+ (mbegin %store-monad
+ (return builder)))
(define composer-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 11/48] build-system: cmake: Redefine cmake-build and cmake-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-11-ngraves@ngraves.fr
* guix/build-system/cmake.scm
(cmake-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I0c3ceb08391a38c52521416093d2c4b2ae869165
---
guix/build-system/cmake.scm | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)

Toggle diff (58 lines)
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm
index aa187c9844..39302b3a69 100644
--- a/guix/build-system/cmake.scm
+++ b/guix/build-system/cmake.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -119,7 +120,7 @@ (define* (cmake-build name inputs
disallowed-references)
"Build SOURCE using CMAKE, and with INPUTS. This assumes that SOURCE
provides a 'CMakeLists.txt' file as its build system."
- (define build
+ (define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@@ -151,15 +152,8 @@ (define build
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name build
- #:system system
- #:target #f
- #:graft? #f
- #:substitutable? substitutable?
- #:disallowed-references disallowed-references
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
;;;
@@ -243,14 +237,8 @@ (define %outputs
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #f
- #:substitutable? substitutable?
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define cmake-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 13/48] build-system: copy: Redefine copy-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-13-ngraves@ngraves.fr
* guix/build-system/copy.scm
(copy-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I96dfa099501796df007143db63a49e2adedbee92
---
guix/build-system/copy.scm | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

Toggle diff (31 lines)
diff --git a/guix/build-system/copy.scm b/guix/build-system/copy.scm
index d58931b33c..e6a1cf36f7 100644
--- a/guix/build-system/copy.scm
+++ b/guix/build-system/copy.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2021, 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2023 Jonathan Brielmaier <jonathan.brielmaier@web.de>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -126,14 +127,8 @@ (define builder
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:substitutable? substitutable?
- #:graft? #f
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define copy-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 15/48] build-system: dune: Redefine dune-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-15-ngraves@ngraves.fr
* guix/build-system/dune.scm
(dune-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I2a0a9a771afbe491538ed50aeb47b9fa4fd9341b
---
guix/build-system/dune.scm | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

Toggle diff (36 lines)
diff --git a/guix/build-system/dune.scm b/guix/build-system/dune.scm
index c45f308349..990d94db0f 100644
--- a/guix/build-system/dune.scm
+++ b/guix/build-system/dune.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2021, 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 pukkamustard <pukkamustard@posteo.net>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,6 +22,7 @@
(define-module (guix build-system dune)
#:use-module (guix store)
+ #:use-module (guix monads)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix search-paths)
@@ -152,11 +154,8 @@ (define builder
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile))
+ (mbegin %store-monad
+ (return builder)))
(define dune-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 16/48] build-system: elm: Redefine elm-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-16-ngraves@ngraves.fr
* guix/build-system/elm.scm
(elm-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I9d45b254d5e8fdc337d075e7394e3354c9186ea6
---
guix/build-system/elm.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (27 lines)
diff --git a/guix/build-system/elm.scm b/guix/build-system/elm.scm
index f5321f811b..b8bb4d6aec 100644
--- a/guix/build-system/elm.scm
+++ b/guix/build-system/elm.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -193,11 +194,8 @@ (define builder
(map search-path-specification->sexp
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define elm-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 14/48] build-system: dub: Redefine dub-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-14-ngraves@ngraves.fr
* guix/build-system/dub.scm
(dub-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I678a7287172157688b95cab00175e61852a99c58
---
guix/build-system/dub.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/dub.scm b/guix/build-system/dub.scm
index 951c084398..bf42686e18 100644
--- a/guix/build-system/dub.scm
+++ b/guix/build-system/dub.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2016 David Craven <david@craven.ch>
;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -93,11 +94,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (lower name
#:key source inputs native-inputs outputs system target
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 17/48] build-system: emacs: Redefine emacs-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-17-ngraves@ngraves.fr
* guix/build-system/emacs.scm
(emacs-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I89cc8c1171eef7c5e02e35df5e1298ce3813c1b5
---
guix/build-system/emacs.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm
index ebf97a5344..c16771ad76 100644
--- a/guix/build-system/emacs.scm
+++ b/guix/build-system/emacs.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -116,11 +117,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define emacs-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 18/48] build-system: font: Redefine font-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-18-ngraves@ngraves.fr
* guix/build-system/font.scm
(font-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I2a4838fc616e4ef8819b292d6842961284288867
---
guix/build-system/font.scm | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/build-system/font.scm b/guix/build-system/font.scm
index c57c304f52..461f8cdd82 100644
--- a/guix/build-system/font.scm
+++ b/guix/build-system/font.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -106,13 +107,8 @@ (define builder
search-paths))
#:inputs %build-inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define font-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 19/48] build-system: glib-or-gtk: Improve glib-or-gtk-cross-build style.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-19-ngraves@ngraves.fr
* guix/build-system/glib-or-gtk.scm
(glib-or-gtk-cross-build): Use with-imported-modules around the
glib-or-gtk-cross-build builder gexp.

Change-Id: I8eaa032ffc0a3f8dbf02c96a4ecee85475c32111
---
guix/build-system/glib-or-gtk.scm | 89 +++++++++++++++----------------
1 file changed, 44 insertions(+), 45 deletions(-)

Toggle diff (114 lines)
diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm
index 726d19efad..90da8d28f0 100644
--- a/guix/build-system/glib-or-gtk.scm
+++ b/guix/build-system/glib-or-gtk.scm
@@ -224,55 +224,55 @@ (define* (glib-or-gtk-cross-build name
disallowed-references)
"Cross-build SOURCE with INPUTS. See GNU-BUILD for more details."
(define builder
- #~(begin
- (use-modules #$@(sexp->gexp modules))
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
- (define %build-host-inputs
- #+(input-tuples->gexp build-inputs))
+ (define %build-host-inputs
+ #+(input-tuples->gexp build-inputs))
- (define %build-target-inputs
- (append #$(input-tuples->gexp host-inputs)
- #+(input-tuples->gexp target-inputs)))
+ (define %build-target-inputs
+ (append #$(input-tuples->gexp host-inputs)
+ #+(input-tuples->gexp target-inputs)))
- (define %build-inputs
- (append %build-host-inputs %build-target-inputs))
+ (define %build-inputs
+ (append %build-host-inputs %build-target-inputs))
- (define %outputs
- #$(outputs->gexp outputs))
-
- (glib-or-gtk-build #:source #+source
- #:system #$system
- #:build #$build
- #:target #$target
- #:outputs %outputs
- #:inputs %build-target-inputs
- #:native-inputs %build-host-inputs
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:native-search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- native-search-paths))
- #:phases #$(if (pair? phases)
- (sexp->gexp phases)
- phases)
- #:glib-or-gtk-wrap-excluded-outputs
- #$glib-or-gtk-wrap-excluded-outputs
- #:configure-flags #$configure-flags
- #:make-flags #$make-flags
- #:out-of-source? #$out-of-source?
- #:tests? #$tests?
- #:test-target #$test-target
- #:parallel-build? #$parallel-build?
- #:parallel-tests? #$parallel-tests?
- #:validate-runpath? #$validate-runpath?
- #:make-dynamic-linker-cache? #$make-dynamic-linker-cache?
- #:patch-shebangs? #$patch-shebangs?
- #:strip-binaries? #$strip-binaries?
- #:strip-flags #$strip-flags
- #:strip-directories
- #$strip-directories)))
+ (define %outputs
+ #$(outputs->gexp outputs))
+ (glib-or-gtk-build #:source #+source
+ #:system #$system
+ #:build #$build
+ #:target #$target
+ #:outputs %outputs
+ #:inputs %build-target-inputs
+ #:native-inputs %build-host-inputs
+ #:search-paths '#$(sexp->gexp
+ (map search-path-specification->sexp
+ search-paths))
+ #:native-search-paths '#$(sexp->gexp
+ (map search-path-specification->sexp
+ native-search-paths))
+ #:phases #$(if (pair? phases)
+ (sexp->gexp phases)
+ phases)
+ #:glib-or-gtk-wrap-excluded-outputs
+ #$glib-or-gtk-wrap-excluded-outputs
+ #:configure-flags #$configure-flags
+ #:make-flags #$make-flags
+ #:out-of-source? #$out-of-source?
+ #:tests? #$tests?
+ #:test-target #$test-target
+ #:parallel-build? #$parallel-build?
+ #:parallel-tests? #$parallel-tests?
+ #:validate-runpath? #$validate-runpath?
+ #:make-dynamic-linker-cache? #$make-dynamic-linker-cache?
+ #:patch-shebangs? #$patch-shebangs?
+ #:strip-binaries? #$strip-binaries?
+ #:strip-flags #$strip-flags
+ #:strip-directories
+ #$strip-directories))))
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
system #:graft? #f)))
@@ -280,7 +280,6 @@ (define %outputs
#:system system
#:target target
#:graft? #f
- #:modules imported-modules
#:allowed-references allowed-references
#:disallowed-references disallowed-references
#:guile-for-build guile)))
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 20/48] build-system: glib-or-gtk: Redefine glib-or-gtk-build functions.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-20-ngraves@ngraves.fr
* guix/build-system/glib-or-gtk.scm
(glib-or-gtk-build): Monadic procedure returns a gexp instead of a derivation.
(glib-or-gtk-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I24f722e47f3ecce7132a7647b5689f6c10abbfd6
---
guix/build-system/glib-or-gtk.scm | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)

Toggle diff (60 lines)
diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm
index 90da8d28f0..696b9b1ea8 100644
--- a/guix/build-system/glib-or-gtk.scm
+++ b/guix/build-system/glib-or-gtk.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -148,7 +149,7 @@ (define* (glib-or-gtk-build name inputs
allowed-references
disallowed-references)
"Build SOURCE with INPUTS. See GNU-BUILD for more details."
- (define build
+ (define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@@ -180,16 +181,8 @@ (define build
#:strip-directories
#$strip-directories)))))
-
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name build
- #:system system
- #:target #f
- #:graft? #f
- #:allowed-references allowed-references
- #:disallowed-references disallowed-references
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (glib-or-gtk-cross-build name
#:key
@@ -274,15 +267,8 @@ (define %outputs
#:strip-directories
#$strip-directories))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #f
- #:allowed-references allowed-references
- #:disallowed-references disallowed-references
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define glib-or-gtk-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 21/48] build-system: go: Redefine go-build and go-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-21-ngraves@ngraves.fr
* guix/build-system/go.scm
(go-build): Monadic procedure returns a gexp instead of a derivation.
(go-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I5222463ee5c37f4cd987ac60b1cf2c46eeb79008
---
guix/build-system/go.scm | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)

Toggle diff (54 lines)
diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index 0934fded07..6e8f3c8153 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021, 2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -217,11 +218,8 @@ (define builder
#:allow-go-reference? #$allow-go-reference?
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (go-cross-build name
#:key
@@ -257,7 +255,7 @@ (define %build-host-inputs
(define %build-target-inputs
(append #$(input-tuples->gexp host-inputs)
- #+(input-tuples->gexp target-inputs)))
+ #+(input-tuples->gexp target-inputs)))
(define %build-inputs
(append %build-host-inputs %build-target-inputs))
@@ -289,14 +287,8 @@ (define %outputs
#:allow-go-reference? #$allow-go-reference?
#:inputs %build-inputs))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #f
- #:substitutable? substitutable?
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define go-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 22/48] build-system: guile: Redefine guile-build and guile-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-22-ngraves@ngraves.fr
* guix/build-system/guile.scm
(guile-build): Monadic procedure returns a gexp instead of a derivation.
(guile-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I60f2d7707f064ef6a678e8e47e21309d0eb545ef
---
guix/build-system/guile.scm | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)

Toggle diff (47 lines)
diff --git a/guix/build-system/guile.scm b/guix/build-system/guile.scm
index bd3bb1c870..1ba99308aa 100644
--- a/guix/build-system/guile.scm
+++ b/guix/build-system/guile.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018-2019, 2021-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -109,14 +110,8 @@ (define builder
#:search-paths '#$(map search-path-specification->sexp
search-paths)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:substitutable? substitutable?
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (guile-cross-build name
#:key
@@ -170,14 +165,8 @@ (define %outputs
#:make-dynamic-linker-cache? #f ;cross-compiling
#:phases #$phases))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #f
- #:substitutable? substitutable?
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define guile-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 23/48] build-system: haskell: Redefine haskell-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-23-ngraves@ngraves.fr
* guix/build-system/haskell.scm
(haskell-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Iaa4e6af7a69a9bd2710572054b1f304a7701f113
---
guix/build-system/haskell.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm
index f8568e33db..31561654d8 100644
--- a/guix/build-system/haskell.scm
+++ b/guix/build-system/haskell.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -178,11 +179,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs))))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define haskell-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 24/48] build-system: julia: Redefine julia-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-24-ngraves@ngraves.fr
* guix/build-system/julia.scm
(julia-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I34303f6cc1423e60f3aa8f66409ca0563e9876cb
---
guix/build-system/julia.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/julia.scm b/guix/build-system/julia.scm
index b5521e38e4..6cbd2c8028 100644
--- a/guix/build-system/julia.scm
+++ b/guix/build-system/julia.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
;;; Copyright © 2021, 2022 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -111,11 +112,8 @@ (define builder
#:julia-package-uuid #$julia-package-uuid
#:julia-package-dependencies #$julia-package-dependencies))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define julia-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 25/48] build-system: linux-module: Redefine linux-module-build functions.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-25-ngraves@ngraves.fr
* guix/build-system/linux-module.scm
(linux-module-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I289c0c77a219445ae0c21f1a9709a67063b38f55
---
guix/build-system/linux-module.scm | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

Toggle diff (44 lines)
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm
index e46195b53c..87aa485bc1 100644
--- a/guix/build-system/linux-module.scm
+++ b/guix/build-system/linux-module.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -189,12 +190,8 @@ (define builder
#:parallel-build? #$parallel-build?
#:inputs #$(input-tuples->gexp inputs))))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile
- #:substitutable? substitutable?)))
+ (mbegin %store-monad
+ (return builder)))
(define* (linux-module-build-cross
name
@@ -249,12 +246,8 @@ (define %build-target-inputs
#:phases #$phases
#:tests? #$tests?))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile
- #:substitutable? substitutable?)))
+ (mbegin %store-monad
+ (return builder)))
(define linux-module-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 26/48] build-system: maven: Redefine maven-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-26-ngraves@ngraves.fr
* guix/build-system/maven.scm
(maven-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ieb96bcdb1c654371279bd7295ea69e2dfad71175
---
guix/build-system/maven.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/maven.scm b/guix/build-system/maven.scm
index 4bbeaed6a4..22e86eb78b 100644
--- a/guix/build-system/maven.scm
+++ b/guix/build-system/maven.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2021, 2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -185,11 +186,8 @@ (define builder
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define maven-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:02 +0100
[PATCH 27/48] build-system: meson: Redefine meson-build and meson-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-27-ngraves@ngraves.fr
* guix/build-system/meson.scm
(meson-build): Monadic procedure returns a gexp instead of a derivation.
(meson-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Id801e757463080dbeedc05a43bd0b2ae23fae4c7
---
guix/build-system/meson.scm | 25 +++++--------------------
1 file changed, 5 insertions(+), 20 deletions(-)

Toggle diff (52 lines)
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm
index bf9ca15ecc..410d981bf0 100644
--- a/guix/build-system/meson.scm
+++ b/guix/build-system/meson.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2021, 2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -237,16 +238,8 @@ (define build-phases
#:strip-directories #$strip-directories
#:elf-directories #$(sexp->gexp elf-directories))))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:substitutable? substitutable?
- #:allowed-references allowed-references
- #:disallowed-references disallowed-references
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (meson-cross-build name
#:key
@@ -350,16 +343,8 @@ (define build-phases
#:strip-directories #$strip-directories
#:elf-directories #$(sexp->gexp elf-directories)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #f
- #:substitutable? substitutable?
- #:allowed-references allowed-references
- #:disallowed-references disallowed-references
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define meson-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 28/48] build-system: minify: Redefine minify-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-28-ngraves@ngraves.fr
* guix/build-system/minify.scm
(minify-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ib009adcec6791d7145ce0d822745495dad9cf6e5
---
guix/build-system/minify.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/minify.scm b/guix/build-system/minify.scm
index b377b506b5..a7536520e7 100644
--- a/guix/build-system/minify.scm
+++ b/guix/build-system/minify.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2018, 2023 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -97,11 +98,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define minify-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 29/48] build-system: mix: Redefine mix-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-29-ngraves@ngraves.fr
* guix/build-system/mix.scm
(mix-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I8a31c048d1458ece0f906023763b4585502f7710
---
guix/build-system/mix.scm | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

Toggle diff (31 lines)
diff --git a/guix/build-system/mix.scm b/guix/build-system/mix.scm
index 1b04053d70..5e1ac43578 100644
--- a/guix/build-system/mix.scm
+++ b/guix/build-system/mix.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Pierre-Henry Fröhring <contact@phfrohring.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -130,15 +131,8 @@ (define builder
#: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)))
+ (mbegin %store-monad
+ (return builder)))
(define* (lower name
#:key
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 30/48] build-system: node: Redefine node-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-30-ngraves@ngraves.fr
* guix/build-system/node.scm
(node-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I507547e474c379c0f66dde15abad73787953e5e6
---
guix/build-system/node.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 3f73390809..d17a82b7b9 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -108,11 +109,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define node-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 31/48] build-system: ocaml: Redefine ocaml-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-31-ngraves@ngraves.fr
* guix/build-system/ocaml.scm
(ocaml-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ib525ddc1df03b33b95a433dd2add79405f611f94
---
guix/build-system/ocaml.scm | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

Toggle diff (36 lines)
diff --git a/guix/build-system/ocaml.scm b/guix/build-system/ocaml.scm
index 582d00b4cd..1872033e91 100644
--- a/guix/build-system/ocaml.scm
+++ b/guix/build-system/ocaml.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,6 +20,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build-system ocaml)
#:use-module (guix store)
+ #:use-module (guix monads)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix search-paths)
@@ -305,11 +307,8 @@ (define builder
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile))
+ (mbegin %store-monad
+ (return builder)))
(define ocaml-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 32/48] build-system: perl: Redefine perl-build and perl-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-32-ngraves@ngraves.fr
* guix/build-system/perl.scm
(perl-build): Monadic procedure returns a gexp instead of a derivation.
(perl-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Id54ae050c2b64269ea42ec9f89d9c3a84ad4429a
---
guix/build-system/perl.scm | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)

Toggle diff (56 lines)
diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm
index 7c6deb34bf..4de0da15a5 100644
--- a/guix/build-system/perl.scm
+++ b/guix/build-system/perl.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -120,7 +121,7 @@ (define* (perl-build name inputs
(guix build utils))))
"Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE
provides a `Makefile.PL' file as its build system."
- (define build
+ (define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@@ -144,14 +145,8 @@ (define build
#:parallel-tests? #$parallel-tests?
#:outputs %outputs
#:inputs %build-inputs)))))
-
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name build
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (perl-cross-build name #:key
source
@@ -207,13 +202,8 @@ (define builder
#:outputs #$(outputs->gexp outputs)
#:inputs #$inputs
#:native-inputs #+(input-tuples->gexp build-inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:graft? #false
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define perl-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 33/48] build-system: pyproject: Redefine pyproject-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-33-ngraves@ngraves.fr
* guix/build-system/pyproject.scm
(pyproject-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ia26001291b472c69c65647d8bddd1199f0ddc483
---
guix/build-system/pyproject.scm | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

Toggle diff (40 lines)
diff --git a/guix/build-system/pyproject.scm b/guix/build-system/pyproject.scm
index 2a2c3af3f3..c0404d0842 100644
--- a/guix/build-system/pyproject.scm
+++ b/guix/build-system/pyproject.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -100,7 +101,7 @@ (define* (pyproject-build name inputs
(modules '((guix build pyproject-build-system)
(guix build utils))))
"Build SOURCE using PYTHON, and with INPUTS."
- (define build
+ (define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@@ -124,14 +125,8 @@ (define build
search-paths))
#:inputs %build-inputs)))))
-
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name build
- #:system system
- #:graft? #f ;consistent with 'gnu-build'
- #:target #f
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define pyproject-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 34/48] build-system: python: Redefine python-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-34-ngraves@ngraves.fr
* guix/build-system/python.scm
(python-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I1d270fa64192394072279f73ae0d77877d41f01c
---
guix/build-system/python.scm | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

Toggle diff (39 lines)
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index cca009fb28..365d216592 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -182,7 +183,7 @@ (define* (python-build name inputs
(guix build utils))))
"Build SOURCE using PYTHON, and with INPUTS. This assumes that SOURCE
provides a 'setup.py' file as its build system."
- (define build
+ (define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@@ -205,13 +206,8 @@ (define build
#:inputs %build-inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name build
- #:system system
- #:graft? #f ;consistent with 'gnu-build'
- #:target #f
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define python-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 35/48] build-system: qt: Redefine qt-build and qt-cross-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-35-ngraves@ngraves.fr
* guix/build-system/qt.scm
(qt-build): Monadic procedure returns a gexp instead of a derivation.
(qt-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I194a9d1a7c7600af2e991e1efad627a9ced235d1
---
guix/build-system/qt.scm | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

Toggle diff (44 lines)
diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm
index 978aed0fc1..27296a0f60 100644
--- a/guix/build-system/qt.scm
+++ b/guix/build-system/qt.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2019 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2020 Jakub K?dzio?ka <kuba@kadziolka.net>
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -176,12 +177,8 @@ (define builder
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:graft? #f ;consistent with 'gnu-build'
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
;;;
@@ -263,12 +260,8 @@ (define %outputs
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:graft? #f ;consistent with 'gnu-build'
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define qt-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 36/48] build-system: r: Redefine r-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-36-ngraves@ngraves.fr
* guix/build-system/r.scm
(r-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I8f5a76eac6b65beba95852b7bf1645cd8a7b255a
---
guix/build-system/r.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (29 lines)
diff --git a/guix/build-system/r.scm b/guix/build-system/r.scm
index 7ab4db82b6..e6e3a99a8d 100644
--- a/guix/build-system/r.scm
+++ b/guix/build-system/r.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015-2023 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -135,12 +136,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile
- #:substitutable? substitutable?)))
+ (mbegin %store-monad
+ (return builder)))
(define r-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 37/48] build-system: rakudo: Redefine rakudo-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-37-ngraves@ngraves.fr
* guix/build-system/rakudo.scm
(rakudo-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I5f484023b8eb9806ed366e5fc596b844a61f524e
---
guix/build-system/rakudo.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/rakudo.scm b/guix/build-system/rakudo.scm
index 3b30fdfd0e..9bcf178c29 100644
--- a/guix/build-system/rakudo.scm
+++ b/guix/build-system/rakudo.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -127,11 +128,8 @@ (define builder
#:outputs #$(outputs->gexp outputs)
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define rakudo-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 38/48] build-system: rebar: Redefine rebar-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-38-ngraves@ngraves.fr
* guix/build-system/rebar.scm
(rebar-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I7d4a29cfc1bedaa762e25deed41cc0eb802abb9f
---
guix/build-system/rebar.scm | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

Toggle diff (32 lines)
diff --git a/guix/build-system/rebar.scm b/guix/build-system/rebar.scm
index de1294ec3f..8acaf49fc2 100644
--- a/guix/build-system/rebar.scm
+++ b/guix/build-system/rebar.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -139,15 +140,8 @@ (define builder
search-paths))
#:inputs %build-inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- ;; Note: Always pass #:graft? #f. Without it, ALLOWED-REFERENCES &
- ;; co. would be interpreted as referring to grafted packages.
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define rebar-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 39/48] build-system: renpy: Redefine renpy-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-39-ngraves@ngraves.fr
* guix/build-system/renpy.scm
(renpy-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I20bf5af43fc9fc41fb2f36637e67d35136bf1606
---
guix/build-system/renpy.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (28 lines)
diff --git a/guix/build-system/renpy.scm b/guix/build-system/renpy.scm
index 3039e3c63b..4a20835ce8 100644
--- a/guix/build-system/renpy.scm
+++ b/guix/build-system/renpy.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2021 Leo Prikler <leo.prikler@student.tugraz.at>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -104,11 +105,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define renpy-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 40/48] build-system: ruby: Improve ruby-cross-build style.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-40-ngraves@ngraves.fr
* guix/build-system/ruby.scm
(ruby-cross-build): Use with-imported-modules around the
ruby-cross-build builder gexp.

Change-Id: I1051124f034f2082ccef531e9bcf37913d5a9449
---
guix/build-system/ruby.scm | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)

Toggle diff (65 lines)
diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm
index a3793a9381..77f1312c13 100644
--- a/guix/build-system/ruby.scm
+++ b/guix/build-system/ruby.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2014, 2015, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -88,24 +89,25 @@ (define* (ruby-build name inputs
(guix build utils))))
"Build SOURCE using RUBY and INPUTS."
(define build
- #~(begin
- (use-modules #$@(sexp->gexp modules))
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
- #$(with-build-variables inputs outputs
- #~(ruby-build #:name #$name
- #:source #+source
- #:system #$system
- #:gem-flags #$gem-flags
- #:test-target #$test-target
- #:tests? #$tests?
- #:phases #$(if (pair? phases)
- (sexp->gexp phases)
- phases)
- #:outputs %outputs
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:inputs %build-inputs))))
+ #$(with-build-variables inputs outputs
+ #~(ruby-build #:name #$name
+ #:source #+source
+ #:system #$system
+ #:gem-flags #$gem-flags
+ #:test-target #$test-target
+ #:tests? #$tests?
+ #: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)))
@@ -113,7 +115,6 @@ (define build
#:system system
#:target #f
#:graft? #f
- #:modules imported-modules
#:guile-for-build guile)))
(define ruby-build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 41/48] build-system: ruby: Redefine ruby-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-41-ngraves@ngraves.fr
* guix/build-system/ruby.scm
(ruby-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I8de0e2b382271e9ea09d2be9b6169ccfc792230b
---
guix/build-system/ruby.scm | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

Toggle diff (31 lines)
diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm
index 77f1312c13..99c2f62101 100644
--- a/guix/build-system/ruby.scm
+++ b/guix/build-system/ruby.scm
@@ -88,7 +88,7 @@ (define* (ruby-build name inputs
(modules '((guix build ruby-build-system)
(guix build utils))))
"Build SOURCE using RUBY and INPUTS."
- (define build
+ (define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@(sexp->gexp modules))
@@ -109,13 +109,8 @@ (define build
search-paths))
#:inputs %build-inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name build
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define ruby-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 42/48] build-system: scons: Redefine scons-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-42-ngraves@ngraves.fr
* guix/build-system/scons.scm
(scons-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ic8c99d06ac53b2ba80a02a191d18de92e9c74e6b
---
guix/build-system/scons.scm | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

Toggle diff (36 lines)
diff --git a/guix/build-system/scons.scm b/guix/build-system/scons.scm
index 046ddef740..8bf2e5ee2f 100644
--- a/guix/build-system/scons.scm
+++ b/guix/build-system/scons.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -18,6 +19,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix build-system scons)
+ #:use-module (guix store)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix monads)
@@ -117,11 +119,8 @@ (define builder
(map search-path-specification->sexp
search-paths)))))))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:guile-for-build guile))
+ (mbegin %store-monad
+ (return builder)))
(define scons-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 43/48] build-system: texlive: Redefine texlive-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-43-ngraves@ngraves.fr
* guix/build-system/texlive.scm
(texlive-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I00cc4e5647eec7e5cd7103ccd9ca0beb21361b3a
---
guix/build-system/texlive.scm | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

Toggle diff (31 lines)
diff --git a/guix/build-system/texlive.scm b/guix/build-system/texlive.scm
index 88372faa58..8f5966c5ae 100644
--- a/guix/build-system/texlive.scm
+++ b/guix/build-system/texlive.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Thiago Jung Bauermann <bauermann@kolabnow.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -178,14 +179,8 @@ (define builder
(map search-path-specification->sexp
search-paths)))))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target #f
- #:graft? #f
- #:substitutable? substitutable?
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define texlive-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 44/48] build-system: tree-sitter: Redefine tree-sitter-build functions.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-44-ngraves@ngraves.fr
* guix/build-system/tree-sitter.scm
(tree-sitter-build): Monadic procedure returns a gexp instead of a derivation.
(tree-sitter-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I761d0663a511deefd0626ad427be22df09b72894
---
guix/build-system/tree-sitter.scm | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

Toggle diff (42 lines)
diff --git a/guix/build-system/tree-sitter.scm b/guix/build-system/tree-sitter.scm
index 21c4eb35b2..c9e45b1fb9 100644
--- a/guix/build-system/tree-sitter.scm
+++ b/guix/build-system/tree-sitter.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -119,11 +120,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (tree-sitter-cross-build name
#:key
@@ -179,12 +177,8 @@ (define %build-inputs
search-path-specification->sexp
native-search-paths))))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:target target
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define tree-sitter-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 45/48] build-system: vim: Redefine vim-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-45-ngraves@ngraves.fr
* guix/build-system/vim.scm
(vim-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Iedbb15faac445f169cffa16397b357bc4f15c0f6
---
guix/build-system/vim.scm | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

Toggle diff (42 lines)
diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm
index dddf7ea14b..22c38aefca 100644
--- a/guix/build-system/vim.scm
+++ b/guix/build-system/vim.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Jonathan Scoresby <me@jonscoresby.com>
;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -120,7 +121,7 @@ (define* (vim-build name inputs
(modules '((guix build vim-build-system)
(guix build utils))))
- (define build
+ (define builder
(with-imported-modules imported-modules
#~(begin
(use-modules #$@modules)
@@ -151,16 +152,8 @@ (define build
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories)))))
- (mlet %store-monad
- ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name
- build
- #:system system
- #:target #f
- #:graft? #f
- #:substitutable? substitutable?
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define vim-build-system
(build-system (name 'vim)
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 46/48] build-system: waf: Improve waf-build style.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-46-ngraves@ngraves.fr
* guix/build-system/waf.scm
(waf-build): Use with-imported-modules around the waf-build builder gexp.

Change-Id: Id242046eb4bfef90dba60d7c3b1b68597ddf502e
---
guix/build-system/waf.scm | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)

Toggle diff (52 lines)
diff --git a/guix/build-system/waf.scm b/guix/build-system/waf.scm
index 91b3d0d100..696b6de39d 100644
--- a/guix/build-system/waf.scm
+++ b/guix/build-system/waf.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -86,22 +87,23 @@ (define* (waf-build name inputs
"Build SOURCE with INPUTS. This assumes that SOURCE provides a 'waf' file
as its build system."
(define build
- #~(begin
- (use-modules #$@(sexp->gexp modules))
+ (with-imported-modules imported-modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
- #$(with-build-variables inputs outputs
- #~(waf-build #:name #$name
- #:source #+source
- #:configure-flags #$configure-flags
- #:system #$system
- #:test-target #$test-target
- #:tests? #$tests?
- #:phases #$phases
- #:outputs %outputs
- #:search-paths '#$(sexp->gexp
- (map search-path-specification->sexp
- search-paths))
- #:inputs %build-inputs))))
+ #$(with-build-variables inputs outputs
+ #~(waf-build #:name #$name
+ #:source #+source
+ #:configure-flags #$configure-flags
+ #:system #$system
+ #:test-target #$test-target
+ #:tests? #$tests?
+ #: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)))
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 47/48] build-system: zig: Redefine zig-build.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-47-ngraves@ngraves.fr
* guix/build-system/zig.scm
(zig-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: Ide64e7047d6e7127024471b311366f3cf8533e00
---
guix/build-system/zig.scm | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

Toggle diff (27 lines)
diff --git a/guix/build-system/zig.scm b/guix/build-system/zig.scm
index 1fa4782a2e..57df84f029 100644
--- a/guix/build-system/zig.scm
+++ b/guix/build-system/zig.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Ekaitz Zarraga <ekaitz@elenq.tech>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -77,11 +78,8 @@ (define builder
search-paths))
#:inputs #$(input-tuples->gexp inputs)))))
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f)))
- (gexp->derivation name builder
- #:system system
- #:guile-for-build guile)))
+ (mbegin %store-monad
+ (return builder)))
(define* (zig-cross-build name
#:key
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 09:03 +0100
[PATCH 48/48] build-system: trivial: Redefine trivial-build functions.
(address . 68315@debbugs.gnu.org)(address . ngraves@ngraves.fr)
20240108080350.1665-48-ngraves@ngraves.fr
* guix/build-system/trivial.scm
(trivial-build): Monadic procedure returns a gexp instead of a derivation.
(trivial-cross-build): Monadic procedure returns a gexp instead of a derivation.

Change-Id: I261d5d5ae027a174eafa972e4f598afdc394caa3
---
guix/build-system/trivial.scm | 41 ++++++++++++++---------------------
1 file changed, 16 insertions(+), 25 deletions(-)

Toggle diff (69 lines)
diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm
index e08884baf1..bc71c94132 100644
--- a/guix/build-system/trivial.scm
+++ b/guix/build-system/trivial.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2018, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -51,18 +52,13 @@ (define* (trivial-build name inputs
search-paths allowed-references)
"Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
ignored."
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f))
- (builder -> (if (pair? builder)
- (sexp->gexp builder)
- builder)))
- (gexp->derivation name (with-build-variables inputs outputs builder)
- #:system system
- #:target #f
- #:graft? #f
- #:modules modules
- #:allowed-references allowed-references
- #:guile-for-build guile)))
+ (mlet* %store-monad ((builder -> (if (pair? builder)
+ (sexp->gexp builder)
+ builder)))
+ (return (with-imported-modules modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
+ #$(with-build-variables inputs outputs builder))))))
(define* (trivial-cross-build name
#:key
@@ -73,21 +69,16 @@ (define* (trivial-cross-build name
allowed-references)
"Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
ignored."
- (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
- system #:graft? #f))
- (builder -> (if (pair? builder)
+ (mlet* %store-monad ((builder -> (if (pair? builder)
(sexp->gexp builder)
builder)))
- (gexp->derivation name (with-build-variables
- (append build-inputs target-inputs host-inputs)
- outputs
- builder)
- #:system system
- #:target target
- #:graft? #f
- #:modules modules
- #:allowed-references allowed-references
- #:guile-for-build guile)))
+ (return (with-imported-modules modules
+ #~(begin
+ (use-modules #$@(sexp->gexp modules))
+ #$(with-build-variables
+ (append build-inputs target-inputs host-inputs)
+ outputs
+ builder))))))
(define trivial-build-system
(build-system
--
2.41.0
N
N
Nicolas Graves wrote on 8 Jan 23:49 +0100
(address . 68315@debbugs.gnu.org)
871qarigo9.fsf@ngraves.fr
This last patch can be skipped if we want to avoid a lot of rebuilds,
and it doesn't matter for easier extensibility since the trivial
build-system is extensible.


On 2024-01-08 09:03, Nicolas Graves wrote:

Toggle quote (77 lines)
> * guix/build-system/trivial.scm
> (trivial-build): Monadic procedure returns a gexp instead of a derivation.
> (trivial-cross-build): Monadic procedure returns a gexp instead of a derivation.
>
> Change-Id: I261d5d5ae027a174eafa972e4f598afdc394caa3
> ---
> guix/build-system/trivial.scm | 41 ++++++++++++++---------------------
> 1 file changed, 16 insertions(+), 25 deletions(-)
>
> diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm
> index e08884baf1..bc71c94132 100644
> --- a/guix/build-system/trivial.scm
> +++ b/guix/build-system/trivial.scm
> @@ -1,5 +1,6 @@
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2012, 2013, 2014, 2015, 2018, 2021 Ludovic Courtès <ludo@gnu.org>
> +;;; Copyright © 2024 Nicolas Graves <ngraves@ngraves.fr>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -51,18 +52,13 @@ (define* (trivial-build name inputs
> search-paths allowed-references)
> "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
> ignored."
> - (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
> - system #:graft? #f))
> - (builder -> (if (pair? builder)
> - (sexp->gexp builder)
> - builder)))
> - (gexp->derivation name (with-build-variables inputs outputs builder)
> - #:system system
> - #:target #f
> - #:graft? #f
> - #:modules modules
> - #:allowed-references allowed-references
> - #:guile-for-build guile)))
> + (mlet* %store-monad ((builder -> (if (pair? builder)
> + (sexp->gexp builder)
> + builder)))
> + (return (with-imported-modules modules
> + #~(begin
> + (use-modules #$@(sexp->gexp modules))
> + #$(with-build-variables inputs outputs builder))))))
>
> (define* (trivial-cross-build name
> #:key
> @@ -73,21 +69,16 @@ (define* (trivial-cross-build name
> allowed-references)
> "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is
> ignored."
> - (mlet %store-monad ((guile (package->derivation (or guile (default-guile))
> - system #:graft? #f))
> - (builder -> (if (pair? builder)
> + (mlet* %store-monad ((builder -> (if (pair? builder)
> (sexp->gexp builder)
> builder)))
> - (gexp->derivation name (with-build-variables
> - (append build-inputs target-inputs host-inputs)
> - outputs
> - builder)
> - #:system system
> - #:target target
> - #:graft? #f
> - #:modules modules
> - #:allowed-references allowed-references
> - #:guile-for-build guile)))
> + (return (with-imported-modules modules
> + #~(begin
> + (use-modules #$@(sexp->gexp modules))
> + #$(with-build-variables
> + (append build-inputs target-inputs host-inputs)
> + outputs
> + builder))))))
>
> (define trivial-build-system
> (build-system

--
Best regards,
Nicolas Graves
N
N
Nicolas Graves wrote on 13 Apr 22:53 +0200
[Nicolas Graves] Re: [PATCH 00/48] Extend bag-build to gexps.
(address . 68315@debbugs.gnu.org)
87a5lxnfwj.fsf@ngraves.fr
-------------------- Start of forwarded message --------------------
From: Nicolas Graves <ngraves@ngraves.fr>
To: guix-devel@gnu.org
Cc: Andrew Tropin <andrew@trop.in>
Subject: Re: [PATCH 00/48] Extend bag-build to gexps.
Date: Wed, 10 Jan 2024 22:50:05 +0100
Here's a more complete proof of concept:

The attached file guix.scm, when run a checkout of emacs branch emacs-29
with guix build -f guix.scm will :
- compile everything as if run locally but with the patches provided by
guix sources.
- a local edit and the rerun of guix build -f guix.scm will only compile
new / changed code.

Now I can try developping emacs without worring about huge compilation
times and without the developping issues that would happen if I ran the
build-system by hand without the patches.

We could even imagine adding an option to guix shell -D that could drop
such a file for any package, since most of the code is reproducible
(although applying a derivation this way is still quite hacky).
Attachment: guix.scm
Attachment: file
-------------------- End of forwarded message --------------------

--
Best regards,
Nicolas Graves
?