Compare commits

..

2 Commits

Author SHA1 Message Date
Hilton Chain
dcc1fad668
utils: Add ‘rosenthal-transformation-guix’.
* modules/rosenthal/utils/transformations.scm: New file.
2025-06-11 22:18:54 +08:00
Hilton Chain
c87e5521de
services: cuirass-worker-container: Clean up.
* modules/rosenthal/services/cuirass.scm (cuirass-service-type/hako): New
variable.
(cuirass-worker-container-service-type): Clean up.
2025-06-11 13:33:05 +08:00
2 changed files with 134 additions and 29 deletions

View File

@ -4,6 +4,7 @@
(define-module (rosenthal services cuirass) (define-module (rosenthal services cuirass)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix modules) #:use-module (guix modules)
#:use-module (guix records) #:use-module (guix records)
@ -19,20 +20,63 @@
#:use-module (gnu services admin) #:use-module (gnu services admin)
#:use-module (gnu services base) #:use-module (gnu services base)
#:use-module (gnu services cuirass) #:use-module (gnu services cuirass)
#:use-module (gnu services databases)
#:use-module (gnu services shepherd) #:use-module (gnu services shepherd)
#:use-module (gnu packages linux) #:use-module (gnu packages linux)
#:export (cuirass-worker-container-configuration #:export (cuirass-worker-container-service-type
cuirass-worker-container-configuration
cuirass-worker-container-configuration? cuirass-worker-container-configuration?
this-cuirass-worker-container-configuration this-cuirass-worker-container-configuration
cuirass-worker-container-host-name
cuirass-worker-container-server
cuirass-worker-container-supported-systems
cuirass-worker-container-substitute-urls
cuirass-worker-container-script
cuirass-worker-container-activation cuirass-worker-container-activation
cuirass-worker-container-shepherd cuirass-worker-container-shepherd
cuirass-worker-container-service-type))
cuirass-service-type/hako))
;;;
;;; Cuirass service with avahi-daemon shepherd requirement stripped.
;;;
(define cuirass-service-type/hako
(let ((cuirass-configuration-cuirass
(@@ (gnu services cuirass) cuirass-configuration-cuirass))
(cuirass-activation
(@@ (gnu services cuirass) cuirass-activation))
(cuirass-shepherd-service
(@@ (gnu services cuirass) cuirass-shepherd-service))
(cuirass-account
(@@ (gnu services cuirass) cuirass-account))
(cuirass-postgresql-role
(@@ (gnu services cuirass) cuirass-postgresql-role))
(strip-shepherd-requirement
(lambda (services)
(map (lambda (service)
(if (member 'cuirass-remote-server
(shepherd-service-provision service))
(shepherd-service
(inherit service)
(requirement
(remove (cut eqv? <> 'avahi-daemon)
(shepherd-service-requirement service))))
service))
services))))
(service-type
(name 'cuirass)
(extensions
(list
(service-extension profile-service-type ;for 'info cuirass'
(compose list cuirass-configuration-cuirass))
(service-extension activation-service-type cuirass-activation)
(service-extension shepherd-root-service-type
(compose strip-shepherd-requirement
cuirass-shepherd-service))
(service-extension account-service-type cuirass-account)
;; Make sure postgresql and postgresql-role are instantiated.
(service-extension postgresql-service-type (const #t))
(service-extension postgresql-role-service-type
cuirass-postgresql-role)))
(description "Run the Cuirass continuous integration service."))))
;;; ;;;
;;; Run Cuirass remote worker in container. ;;; Run Cuirass remote worker in container.
;;; ;;;
@ -70,34 +114,33 @@
(match-record-lambda <cuirass-worker-container-configuration> (match-record-lambda <cuirass-worker-container-configuration>
(host-name server workers supported-systems substitute-urls) (host-name server workers supported-systems substitute-urls)
(define cuirass-remote-worker-shepherd-service
(@@ (gnu services cuirass) cuirass-remote-worker-shepherd-service))
(define %cuirass-remote-worker-accounts
(@@ (gnu services cuirass) %cuirass-remote-worker-accounts))
(define (strip-shepherd-requirement services)
(map (lambda (service)
(if (member 'cuirass-remote-worker
(shepherd-service-provision service))
(shepherd-service
(inherit service)
(requirement
(remove (cut member <> '(avahi-daemon guix-daemon))
(shepherd-service-requirement service))))
service))
services))
(define cuirass-remote-worker-for-container (define cuirass-remote-worker-for-container
(service-type (service-type
(name 'cuirass-remote-worker) (name 'cuirass-remote-worker)
(extensions (extensions
(list (service-extension shepherd-root-service-type (list (service-extension shepherd-root-service-type
(compose (compose strip-shepherd-requirement
(lambda (services) cuirass-remote-worker-shepherd-service))
(map
(lambda (s)
(if (member 'cuirass-remote-worker
(shepherd-service-provision s))
(shepherd-service
(inherit s)
(requirement
(lset-difference
eqv?
(shepherd-service-requirement s)
'(avahi-daemon guix-daemon))))
s))
services))
(@@ (gnu services cuirass)
cuirass-remote-worker-shepherd-service)))
(service-extension account-service-type (service-extension account-service-type
(const (const %cuirass-remote-worker-accounts))))
(@@ (gnu services cuirass) (description "Run the Cuirass remote build worker service.")))
%cuirass-remote-worker-accounts)))))
(description
"Run the Cuirass remote build worker service.")))
(define os (define os
(operating-system (operating-system
@ -123,6 +166,7 @@
(publish-port 5558) (publish-port 5558)
(substitute-urls substitute-urls))) (substitute-urls substitute-urls)))
%base-services)))) %base-services))))
(with-store store (with-store store
(run-with-store store (run-with-store store
(container-script os #:shared-network? #t))))) (container-script os #:shared-network? #t)))))

View File

@ -0,0 +1,61 @@
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2025 Hilton Chain <hako@ultrarare.space>
(define-module (rosenthal utils transformations)
#:use-module (guix channels)
#:use-module (guix gexp)
#:use-module (gnu system)
#:use-module (gnu services)
#:use-module (gnu services base)
#:use-module (gnu packages package-management)
#:export (rosenthal-transformation-guix))
(define* (rosenthal-transformation-guix #:key (substitutes? #t)
(channel? #t)
(guix-source? #f))
(define %rosenthal-signing-key
(plain-file "rosenthal.pub" "
(public-key
(ecc
(curve Ed25519)
(q #374EC58F5F2EC0412431723AF2D527AD626B049D657B5633AAAEBC694F3E33F9#)))"))
(define %rosenthal-channel
(channel
(name 'rosenthal)
(url "https://codeberg.org/hako/rosenthal.git")
(branch "trunk")
(introduction
(make-channel-introduction
"7677db76330121a901604dfbad19077893865f35"
(openpgp-fingerprint
"13E7 6CD6 E649 C28C 3385 4DF5 5E5A A665 6149 17F7")))))
(lambda (os)
(operating-system
(inherit os)
(services
(modify-services (operating-system-user-services os)
(guix-service-type
config => (guix-configuration
(inherit config)
(channels
(let ((configured-channels
(guix-configuration-channels config)))
(if channel?
(cons %rosenthal-channel
(or configured-channels %default-channels))
configured-channels)))
(guix
(if guix-source?
(guix-for-channels channels)
(guix-configuration-guix config)))
(authorized-keys
(cons %rosenthal-signing-key
(guix-configuration-authorized-keys config)))
(substitute-urls
`(,@(guix-configuration-substitute-urls config)
,@(if substitutes?
'("https://ci.boiledscript.com")
'()))))))))))