Pin Tribes packaging to upstream source

This commit is contained in:
2026-03-31 20:40:58 +02:00
parent bd704e5d9c
commit 7e63eb9c2f
5 changed files with 109 additions and 29 deletions

View File

@@ -16,20 +16,27 @@
"neovim"
"btop"))
(define (make-tribes-node-manifest)
(define (getenv/default name default)
(or (getenv name) default))
(define (tribes-node-package)
(let ((source-directory (getenv "TRIBES_SOURCE_DIRECTORY")))
(packages->manifest
(append
(map specification->package %tribes-node-specifications)
(list erlang-28
elixir-otp28
elixir-hex-otp28
ghostty-terminfo)
(if source-directory
(list
(tribes-source-package
(tribes-source-directory->local-file source-directory)
#:version (or (getenv "TRIBES_RELEASE_VERSION") "dev")))
'())))))
(if source-directory
(local-tribes-package
source-directory
#:version (getenv/default "TRIBES_RELEASE_VERSION" "dev")
#:mix-deps-sha256 (getenv "TRIBES_MIX_DEPS_SHA256")
#:raw-mix-deps-sha256 (getenv "TRIBES_RAW_MIX_DEPS_SHA256"))
tribes-package)))
(define (make-tribes-node-manifest)
(packages->manifest
(append
(map specification->package %tribes-node-specifications)
(list erlang-28
elixir-otp28
elixir-hex-otp28
ghostty-terminfo
(tribes-node-package)))))
(make-tribes-node-manifest)

View File

@@ -4,9 +4,18 @@
#:use-module (gnu services desktop)
#:use-module (gnu services networking)
#:use-module (gnu services ssh)
#:use-module (guix gexp)
#:use-module (nbde system boot-store)
#:export (nbde-installed-operating-system))
(define %tribe-one-guix-substitute-url
"https://guix.tribe-one.org")
(define %tribe-one-guix-signing-key
(plain-file
"guix.tribe-one.org-signing-key.pub"
"(public-key \n (ecc \n (curve Ed25519)\n (q #77082B3CAB885E20111604F2C0E36E56750A6FBB732E2B367DAE2B09BA3873DE#)\n )\n )\n"))
(define* (nbde-installed-operating-system #:key
host-name
bootloader
@@ -52,5 +61,11 @@ runtime-discovered boot and filesystem values from the installer."
(permit-root-login 'prohibit-password)
(authorized-keys
(list
(list "root" authorized-keys-file))))))
(list "root" authorized-keys-file)))))
(simple-service
'tribe-one-guix-substitutes
guix-service-type
(guix-extension
(authorized-keys (list %tribe-one-guix-signing-key))
(substitute-urls (list %tribe-one-guix-substitute-url)))))
%base-services))))

View File

@@ -7,6 +7,7 @@
#:use-module (gnu packages admin)
#:use-module (gnu packages bash)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
#:use-module (gnu packages erlang)
#:use-module (gnu packages nss)
#:use-module (gnu packages version-control)
@@ -46,6 +47,8 @@ SOURCE according to mix.lock."
#$(file-append coreutils "/bin")
#$(file-append findutils "/bin")
#$(file-append git-minimal "/bin")
#$(file-append gzip "/bin")
#$(file-append tar "/bin")
(or (getenv "PATH") ""))
":"))
@@ -178,6 +181,8 @@ MIX-FOD-DEPS as a pre-fetched dependency tree."
#$(file-append coreutils "/bin")
#$(file-append findutils "/bin")
#$(file-append git-minimal "/bin")
#$(file-append gzip "/bin")
#$(file-append tar "/bin")
#$@extra-path-dirs
(or (getenv "PATH") ""))
":"))

View File

@@ -17,6 +17,8 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-13)
#:export (fetch-mix-deps
local-tribes-package
tribes-package
tribes-source-package
tribes-source-directory->local-file))
@@ -24,13 +26,37 @@
;; from the current Tribes mix.lock, with git metadata stripped except for
;; .git/HEAD in SCM dependencies.
(define %tribes-raw-mix-deps-sha256
"0mv4jva8zkx8cq1b84hn65bl913nnhkvf25g6fi93z3jm35jy0pc")
"12d4w772x09w0cgy6iq2ip33jinxqc1nvffmfprfb5dp7s9pq479")
;; Recursive sha256 of the Tribes-specific prepared deps tree, after injecting
;; the upstream secp256k1 source into the Hex package and patching its build
;; recipe to avoid build-time network access.
(define %tribes-mix-deps-sha256
"0ksjnc9gnjijp1nbz3jlvl9kz8w7hx1a0ssms1dvd15rr25gn0d4")
"0fdgflpc14mxdixfpxmnaa1x4d0hn649jcm9q6ar7byzfg0d99ca")
(define %tribes-home-page
"https://git.teralink.net/tribes/tribes.git")
(define %tribes-commit
"32c64bfba5bb3bf4741e37a3297b249c4cacc76e")
(define %tribes-revision "1")
(define %tribes-version
(git-version "0.2.0" %tribes-revision %tribes-commit))
(define %tribes-source-sha256
"08sx47qpis1h758iwmdnld9x8975wyp1fx96bmly0n723mhx3b60")
(define %tribes-upstream-source
(origin
(method git-fetch)
(uri (git-reference
(url %tribes-home-page)
(commit %tribes-commit)))
(file-name (git-file-name "tribes" %tribes-version))
(sha256
(base32 %tribes-source-sha256))))
(define %libsecp256k1-upstream-source
(origin
@@ -164,9 +190,11 @@ resolution by injecting extra pre-fetched sources needed for offline builds."
#:key
(mix-deps #f)
(mix-deps-sha256 %tribes-mix-deps-sha256)
(raw-mix-deps-sha256
%tribes-raw-mix-deps-sha256)
(name "tribes")
(version "0.2.0")
(home-page "https://git.teralink.net/tribes/tribes.git")
(version %tribes-version)
(home-page %tribes-home-page)
(synopsis "Tribes social app")
(description
"Tribes social application built from source as a
@@ -178,7 +206,8 @@ using MIX-DEPS as the pre-fetched Mix dependency tree resolved from mix.lock."
(tribes-mix-deps source
#:name (string-append name "-mix-deps")
#:version version
#:sha256 mix-deps-sha256))))
#:sha256 mix-deps-sha256
#:raw-sha256 raw-mix-deps-sha256))))
(mix:mix-release-package
source
#:mix-fod-deps mix-deps-source
@@ -255,3 +284,22 @@ using MIX-DEPS as the pre-fetched Mix dependency tree resolved from mix.lock."
(setenv "ERL_FLAGS" existing-erl-flags)
(unsetenv "ERL_FLAGS")))
(invoke "mix" "deps.compile")))))
(define* (local-tribes-package directory
#:key
(version "dev")
(mix-deps-sha256 #f)
(raw-mix-deps-sha256 #f))
"Return a Tribes package built from a local source checkout. Hash overrides
allow development against a changed mix.lock without changing the canonical
package pin."
(tribes-source-package
(tribes-source-directory->local-file directory)
#:version version
#:mix-deps-sha256 (or mix-deps-sha256 %tribes-mix-deps-sha256)
#:raw-mix-deps-sha256
(or raw-mix-deps-sha256 %tribes-raw-mix-deps-sha256)))
(define tribes-package
(tribes-source-package %tribes-upstream-source
#:version %tribes-version))

View File

@@ -26,6 +26,16 @@
(filter (lambda (item) (not (string-null? item)))
(string-split value #\,)))))
(define (tribes-installer-package)
(let ((source-directory (getenv "TRIBES_SOURCE_DIRECTORY")))
(if source-directory
(local-tribes-package
source-directory
#:version (getenv/default "TRIBES_RELEASE_VERSION" "dev")
#:mix-deps-sha256 (getenv "TRIBES_MIX_DEPS_SHA256")
#:raw-mix-deps-sha256 (getenv "TRIBES_RAW_MIX_DEPS_SHA256"))
tribes-package)))
(define* (tribes-installer-operating-system #:key
host-name
bootloader
@@ -35,17 +45,12 @@
interface
authorized-keys-file)
"Return an installed NBDE operating-system extended with PostgreSQL and the
Tribes service. The package is built from TRIBES_SOURCE_DIRECTORY."
(let* ((source-directory (getenv "TRIBES_SOURCE_DIRECTORY"))
(service-user (getenv/default "TRIBES_SERVICE_USER" "tribes"))
Tribes service. By default it uses the pinned upstream package; setting
TRIBES_SOURCE_DIRECTORY switches to a development source override."
(let* ((service-user (getenv/default "TRIBES_SERVICE_USER" "tribes"))
(service-group (getenv/default "TRIBES_SERVICE_GROUP" service-user))
(database-user (getenv/default "TRIBES_DATABASE_USER" service-user))
(package
(if source-directory
(tribes-source-package
(tribes-source-directory->local-file source-directory)
#:version (getenv/default "TRIBES_RELEASE_VERSION" "dev"))
(error "missing Tribes source input; set TRIBES_SOURCE_DIRECTORY")))
(package (tribes-installer-package))
(tribes-config
(tribes-configuration
(package package)