aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
Diffstat (limited to 'guix')
-rw-r--r--guix/forge/laminar.scm60
1 files changed, 34 insertions, 26 deletions
diff --git a/guix/forge/laminar.scm b/guix/forge/laminar.scm
index 61d1d20..65b3347 100644
--- a/guix/forge/laminar.scm
+++ b/guix/forge/laminar.scm
@@ -1,5 +1,5 @@
;;; guix-forge --- Guix software forge meta-service
-;;; Copyright © 2021, 2022 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2021–2022, 2024 Arun Isaac <arunisaac@systemreboot.net>
;;;
;;; This file is part of guix-forge.
;;;
@@ -67,6 +67,35 @@
(name forge-laminar-group-name)
(regex forge-laminar-group-regex))
+(define (laminar-groups groups)
+ "Return a file-like object describing @var{groups}, a list of
+@code{<forge-laminar-groups>} objects."
+ (plain-file "laminar-groups"
+ (string-join (map (lambda (group)
+ (string-append (forge-laminar-group-name group)
+ "="
+ (forge-laminar-group-regex group)))
+ groups)
+ "\n")))
+
+(define (laminar-jobs jobs)
+ "Return a file-like object describing a directory of @var{jobs}, a list
+of @var{<forge-laminar-job>} objects."
+ (file-union "laminar-jobs"
+ (append-map (lambda (job)
+ (let ((name (forge-laminar-job-name job))
+ (run (forge-laminar-job-run job))
+ (after (forge-laminar-job-after job)))
+ (cons (let ((run-name (string-append name ".run")))
+ (list run-name
+ (program-file run-name run)))
+ (if after
+ (list (let ((after-name (string-append name ".after")))
+ (list after-name
+ (program-file after-name after))))
+ (list)))))
+ jobs)))
+
(define (forge-laminar-activation config)
(let* ((state-directory (forge-laminar-configuration-state-directory config))
(configuration-directory (string-append state-directory "/cfg"))
@@ -80,35 +109,14 @@
;; Configure groups.
(when (file-exists? #$groups-configuration)
(delete-file #$groups-configuration))
- (symlink
- #$(plain-file "laminar-groups"
- (string-join (map (lambda (group)
- (string-append (forge-laminar-group-name group)
- "="
- (forge-laminar-group-regex group)))
- (forge-laminar-configuration-groups config))
- "\n"))
- #$groups-configuration)
+ (symlink #$(laminar-groups (forge-laminar-configuration-groups config))
+ #$groups-configuration)
;; Create jobs directory and populate with job scripts.
(mkdir-p #$(dirname jobs-directory))
(when (file-exists? #$jobs-directory)
(delete-file #$jobs-directory))
- (symlink
- #$(file-union "laminar-jobs"
- (append-map (lambda (job)
- (let ((name (forge-laminar-job-name job))
- (run (forge-laminar-job-run job))
- (after (forge-laminar-job-after job)))
- (cons (let ((run-name (string-append name ".run")))
- (list run-name
- (program-file run-name run)))
- (if after
- (list (let ((after-name (string-append name ".after")))
- (list after-name
- (program-file after-name after))))
- (list)))))
- (forge-laminar-configuration-jobs config)))
- #$jobs-directory)
+ (symlink #$(laminar-jobs (forge-laminar-configuration-jobs config))
+ #$jobs-directory)
;; Set permissions for laminar directory.
(for-each (lambda (file)
(let ((user (getpw "laminar")))