From: Christopher Baines <mail@cbaines.net>
To: 71038@debbugs.gnu.org
Cc: "Christopher Baines" <guix@cbaines.net>,
"Josselin Poiret" <dev@jpoiret.xyz>,
"Ludovic Courtès" <ludo@gnu.org>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Ricardo Wurmus" <rekado@elephly.net>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#71038] [PATCH 2/2] guix: channels: Enable specifiying available builtin builders.
Date: Sat, 18 May 2024 14:19:35 +0100 [thread overview]
Message-ID: <3724435f5b2e86be53ffba5bffcbfdf493b48e5c.1716038375.git.mail@cbaines.net> (raw)
In-Reply-To: <6b9c634c024b6fd7a50d3b82edc244676a8ca8e8.1716038375.git.mail@cbaines.net>
When computing channel instance derivations.
This is useful when you want to generate compatible derivations that can be
run with a daemon that potentially doesn't support builtin builders that the
daemon you're using to generate the derivations has.
I'm looking at this in particular because I want to use this in the data
service, since it provides substitutes for derivations, and since these can be
built on other machines, it's useful to control which builtin builders they
depend on.
Fixes: <https://issues.guix.gnu.org/67250>.
* build-aux/build-self.scm (build-program): Accept
#:assume-available-builtin-builders and pass along to port->connection or
open-connection as approriate.
(build): Accept and pass on #:assume-available-builtin-builders.
* guix/channels.scm (build-from-source, build-channel-instance,
channel-instance-derivations, channel-instances->manifest,
channel-instances->derivation): Accept and pass on
#:assume-available-builtin-builders.
Change-Id: I315c990de66c6f7dca25a859165a5568abe385ea
---
build-aux/build-self.scm | 28 ++++++++++++++++++--------
guix/channels.scm | 43 +++++++++++++++++++++++++++++-----------
2 files changed, 51 insertions(+), 20 deletions(-)
diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index 02822a2ee8..7afb13c1e4 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -241,7 +241,8 @@ (define guile-gcrypt
(define* (build-program source version
#:optional (guile-version (effective-version))
- #:key (pull-version 0) (channel-metadata #f))
+ #:key (pull-version 0) (channel-metadata #f)
+ assume-available-builtin-builders)
"Return a program that computes the derivation to build Guix from SOURCE."
(define select?
;; Select every module but (guix config) and non-Guix modules.
@@ -331,11 +332,20 @@ (define* (build-program source version
;; case, attempt to open a new connection.
(let* ((proto (string->number protocol-version))
(store (if (integer? proto)
- (port->connection (duplicate-port
- (current-input-port)
- "w+0")
- #:version proto)
- (open-connection)))
+ (port->connection
+ (duplicate-port
+ (current-input-port)
+ "w+0")
+ #:version proto
+ #$@(if assume-available-builtin-builders
+ #~(#:assume-available-builtin-builders
+ '(#$@assume-available-builtin-builders))
+ '()))
+ (open-connection
+ #$@(if assume-available-builtin-builders
+ #~(#:assume-available-builtin-builders
+ '(#$@assume-available-builtin-builders))
+ '()))))
(sock (socket AF_UNIX SOCK_STREAM 0)))
;; Connect to BUILD-OUTPUT and send it the raw
;; build output.
@@ -406,7 +416,7 @@ (define* (build source
(guile-version (if (> pull-version 0)
"3.0"
(effective-version)))
-
+ assume-available-builtin-builders
#:allow-other-keys
#:rest rest)
"Return a derivation that unpacks SOURCE into STORE and compiles Scheme
@@ -415,7 +425,9 @@ (define* (build source
;; SOURCE.
(mlet %store-monad ((build (build-program source version guile-version
#:channel-metadata channel-metadata
- #:pull-version pull-version))
+ #:pull-version pull-version
+ #:assume-available-builtin-builders
+ assume-available-builtin-builders))
(system (if system (return system) (current-system)))
(home -> (getenv "HOME"))
diff --git a/guix/channels.scm b/guix/channels.scm
index 0d7bc541cc..6469d08bb9 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -704,7 +704,8 @@ (define (with-trivial-build-handler mvalue)
store))))
(define* (build-from-source instance
- #:key core verbose? (dependencies '()) system)
+ #:key core verbose? (dependencies '()) system
+ assume-available-builtin-builders)
"Return a derivation to build Guix from INSTANCE, using the self-build
script contained therein. When CORE is true, build package modules under
SOURCE using CORE, an instance of Guix. By default, build for the current
@@ -750,20 +751,25 @@ (define* (build-from-source instance
#:verbose? verbose? #:version commit
#:system system
#:channel-metadata (channel-instance->sexp instance)
- #:pull-version %pull-version))))
+ #:pull-version %pull-version
+ #:assume-available-builtin-builders
+ assume-available-builtin-builders))))
;; Build a set of modules that extend Guix using the standard method.
(standard-module-derivation name source core dependencies)))
(define* (build-channel-instance instance system
- #:optional core (dependencies '()))
+ #:optional core (dependencies '())
+ #:key assume-available-builtin-builders)
"Return, as a monadic value, the derivation for INSTANCE, a channel
instance, for SYSTEM. DEPENDENCIES is a list of extensions providing Guile
modules that INSTANCE depends on."
(build-from-source instance
#:core core
#:dependencies dependencies
- #:system system))
+ #:system system
+ #:assume-available-builtin-builders
+ assume-available-builtin-builders))
(define (resolve-dependencies instances)
"Return a procedure that, given one of the elements of INSTANCES, returns
@@ -793,7 +799,8 @@ (define (resolve-dependencies instances)
(lambda (instance)
(vhash-foldq* cons '() instance edges)))
-(define* (channel-instance-derivations instances #:key system)
+(define* (channel-instance-derivations instances #:key system
+ assume-available-builtin-builders)
"Return the list of derivations to build INSTANCES, in the same order as
INSTANCES. Build for the current system by default, or SYSTEM if specified."
(define core-instance
@@ -809,11 +816,15 @@ (define* (channel-instance-derivations instances #:key system)
(define (instance->derivation instance)
(mlet %store-monad ((system (if system (return system) (current-system))))
(mcached (if (eq? instance core-instance)
- (build-channel-instance instance system)
+ (build-channel-instance instance system
+ #:assume-available-builtin-builders
+ assume-available-builtin-builders)
(mlet %store-monad ((core (instance->derivation core-instance))
(deps (mapm %store-monad instance->derivation
(edges instance))))
- (build-channel-instance instance system core deps)))
+ (build-channel-instance instance system core deps
+ #:assume-available-builtin-builders
+ assume-available-builtin-builders)))
instance
system)))
@@ -915,7 +926,8 @@ (define (channel-instance->sexp instance)
intro))))))
'()))))
-(define* (channel-instances->manifest instances #:key system)
+(define* (channel-instances->manifest instances #:key system
+ assume-available-builtin-builders)
"Return a profile manifest with entries for all of INSTANCES, a list of
channel instances. By default, build for the current system, or SYSTEM if
specified."
@@ -934,8 +946,11 @@ (define* (channel-instances->manifest instances #:key system)
(properties
`((source ,(channel-instance->sexp instance)))))))
- (mlet* %store-monad ((derivations (channel-instance-derivations instances
- #:system system))
+ (mlet* %store-monad ((derivations (channel-instance-derivations
+ instances
+ #:system system
+ #:assume-available-builtin-builders
+ assume-available-builtin-builders))
(entries -> (map instance->entry instances derivations)))
(return (manifest entries))))
@@ -990,10 +1005,14 @@ (define %channel-profile-hooks
;; The default channel profile hooks.
(cons package-cache-file %default-profile-hooks))
-(define (channel-instances->derivation instances)
+(define* (channel-instances->derivation instances
+ #:key assume-available-builtin-builders)
"Return the derivation of the profile containing INSTANCES, a list of
channel instances."
- (mlet %store-monad ((manifest (channel-instances->manifest instances)))
+ (mlet %store-monad ((manifest (channel-instances->manifest
+ instances
+ #:assume-available-builtin-builders
+ assume-available-builtin-builders)))
;; Emit a profile in format version so that, if INSTANCES denotes an old
;; Guix, it can still read that profile, for instance for the purposes of
;; 'guix describe'.
--
2.41.0
next prev parent reply other threads:[~2024-05-18 13:20 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-18 13:11 [bug#71038] [PATCH 0/2] Enable specifying the available builtin builders Christopher Baines
2024-05-18 13:19 ` [bug#71038] [PATCH 1/2] guix: store: " Christopher Baines
2024-05-18 13:19 ` Christopher Baines [this message]
2024-05-22 10:58 ` Simon Tournier
2024-05-26 8:10 ` Christopher Baines
2024-05-27 17:19 ` Simon Tournier
2024-06-11 19:26 ` Christopher Baines
2024-06-24 13:43 ` [bug#71038] [PATCH v2 " Christopher Baines
2024-06-24 13:43 ` [bug#71038] [PATCH v2 2/2] guix: channels: Enable specifiying " Christopher Baines
2024-07-04 9:17 ` Ludovic Courtès
2024-07-04 9:14 ` [bug#71038] [PATCH v2 1/2] guix: store: Enable specifying the " Ludovic Courtès via Guix-patches
2024-07-04 11:50 ` [bug#71038] [PATCH v3 1/2] guix: store: Enable specifying the " Christopher Baines
2024-07-04 11:50 ` [bug#71038] [PATCH v3 2/2] guix: channels: Enable specifiying available " Christopher Baines
2024-07-16 10:05 ` Ludovic Courtès
2024-07-16 13:13 ` Christopher Baines
2024-07-16 12:48 ` [bug#71038] [PATCH v4 1/3] guix: store: Enable specifying the " Christopher Baines
2024-07-16 12:48 ` [bug#71038] [PATCH v4 2/3] guix: channels: Enable specifiying available " Christopher Baines
2024-07-16 12:48 ` [bug#71038] [PATCH v4 3/3] inferior: Use the host built-in-builders with inferior Christopher Baines
2024-07-18 9:35 ` Ludovic Courtès
2024-07-18 13:08 ` bug#71038: " Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3724435f5b2e86be53ffba5bffcbfdf493b48e5c.1716038375.git.mail@cbaines.net \
--to=mail@cbaines.net \
--cc=71038@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=ludo@gnu.org \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=rekado@elephly.net \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.