build(packages): align Guile with the one (guix) was built against

guile-3.0 from (gnu packages guile) is not necessarily the same store
path as the Guile that compiled (guix)'s .go files in a given channel
state.  When they diverge, guild compile (and the broker at runtime)
loads guix/records.go, hits "incompatible bytecode version", falls
back to guix/records.scm, recompiles from source — and that cascades
into hundreds of (gnu packages …) modules through the user cache.

Use (lookup-package-input guix "guile") for both the package's
native-inputs and the program-file shebangs, matching the upstream
guix-modules pattern (gnu/packages/package-management.scm:791).

Effect on a substitute-server build:
- Build phase: no more "loading compiled file … failed" warnings,
  no source-recompile cascade for the guix tree.
- Cold tribes-deploy-exec resolve (which actually loads
  (guix packages) and the plugin registry): ~870 ms with empty
  ~/.cache/guile.
- Cold tribes status: ~60 ms, unchanged.
This commit is contained in:
2026-04-26 10:25:25 +02:00
parent 57cdec590f
commit 7cd9f299fa
+20 -6
View File
@@ -10,6 +10,16 @@
#:use-module (gnu packages package-management)
#:export (tribes-command-package))
;; Guile must match the one (guix) was compiled with. Otherwise our build's
;; `guild compile` (and the broker at runtime) loads (guix records) etc. with
;; an incompatible bytecode version, falls back to recompiling guix from
;; source, and drags hundreds of (gnu packages …) modules through Guile's
;; user cache before our own modules can finish loading. Same idiom as
;; guix-modules — see (lookup-package-input guix "guile") in upstream
;; gnu/packages/package-management.scm.
(define guile-for-guix
(lookup-package-input guix "guile"))
;; ---------------------------------------------------------------------------
;; Three transport binaries — all dispatch through (tribes deploy entry):
;; tribes -> entry 'shell (status command for the UI)
@@ -22,20 +32,24 @@
(define tribes-shell-program
(program-file "tribes"
#~(begin (use-modules (tribes deploy entry)) (main 'shell))))
#~(begin (use-modules (tribes deploy entry)) (main 'shell))
#:guile guile-for-guix))
(define tribes-deploy-exec-program
(program-file "tribes-deploy-exec"
#~(begin (use-modules (tribes deploy entry)) (main 'cli))))
#~(begin (use-modules (tribes deploy entry)) (main 'cli))
#:guile guile-for-guix))
(define tribes-local-control-program
(program-file "tribes-local-control"
#~(begin (use-modules (tribes deploy entry)) (main 'http))))
#~(begin (use-modules (tribes deploy entry)) (main 'http))
#:guile guile-for-guix))
(define tribes-guix-helper-program
(program-file "tribes-guix-helper"
#~(begin (use-modules (tribes deploy helper-main))
(helper-main (cdr (command-line))))))
(helper-main (cdr (command-line))))
#:guile guile-for-guix))
(define tribes-modules-source
(local-file ".." "tribes-modules" #:recursive? #t))
@@ -121,9 +135,9 @@
(wrap-with-paths "tribes-deploy-exec" #t)
(wrap-with-paths "tribes-local-control" #t)))))))
(native-inputs
(list guile-3.0))
(list guile-for-guix guix))
(inputs
(list bash-minimal guile-3.0 guile-json-4
(list bash-minimal guile-for-guix guile-json-4
guix guile-gcrypt guile-gnutls))
(home-page "https://git.teralink.net/tribes/guix-tribes.git")
(synopsis "Tribes node administration command")