aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorArun Isaac2024-01-09 14:56:19 +0000
committerArun Isaac2024-01-09 17:13:02 +0000
commita9e3aa8a44e5394e90509db5ed0f237369ad94dd (patch)
tree42bd7d2ed7c1077977f77fdc15be9563a88d7b5e /guix
parent2374af4b24bea2469045b276e6de2d12b445ecdc (diff)
downloadguix-forge-a9e3aa8a44e5394e90509db5ed0f237369ad94dd.tar.gz
guix-forge-a9e3aa8a44e5394e90509db5ed0f237369ad94dd.tar.lz
guix-forge-a9e3aa8a44e5394e90509db5ed0f237369ad94dd.zip
laminar: Use switch-symlinks, instead of delete-file and symlink.
* guix/forge/laminar.scm (forge-laminar-activation): Use switch-symlinks, instead of delete-file and symlink.
Diffstat (limited to 'guix')
-rw-r--r--guix/forge/laminar.scm44
1 files changed, 21 insertions, 23 deletions
diff --git a/guix/forge/laminar.scm b/guix/forge/laminar.scm
index eb9bc87..8819a2f 100644
--- a/guix/forge/laminar.scm
+++ b/guix/forge/laminar.scm
@@ -101,29 +101,27 @@ of @var{<forge-laminar-job>} objects."
(configuration-directory (string-append state-directory "/cfg"))
(groups-configuration (string-append configuration-directory "/groups.conf"))
(jobs-directory (string-append configuration-directory "/jobs")))
- #~(begin
- ;; Ensure configuration directory exists.
- (mkdir-p #$configuration-directory)
- ;; Configure groups.
- (when (file-exists? #$groups-configuration)
- (delete-file #$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 #$(laminar-jobs (forge-laminar-configuration-jobs config))
- #$jobs-directory)
- ;; Set permissions for laminar directory.
- (for-each (lambda (file)
- (let ((user (getpw "laminar")))
- (chown file (passwd:uid user) (passwd:gid user))))
- (find-files #$state-directory
- (lambda (file stat)
- (memq (stat:type stat)
- '(regular directory)))
- #:directories? #t)))))
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ ;; Ensure configuration directory exists.
+ (mkdir-p #$configuration-directory)
+ ;; Configure groups.
+ (switch-symlinks #$groups-configuration
+ #$(laminar-groups (forge-laminar-configuration-groups config)))
+ ;; Create jobs directory and populate with job scripts.
+ (switch-symlinks #$jobs-directory
+ #$(laminar-jobs (forge-laminar-configuration-jobs config)))
+ ;; Set permissions for laminar directory.
+ (for-each (lambda (file)
+ (let ((user (getpw "laminar")))
+ (chown file (passwd:uid user) (passwd:gid user))))
+ (find-files #$state-directory
+ (lambda (file stat)
+ (memq (stat:type stat)
+ '(regular directory)))
+ #:directories? #t))))))
(define forge-laminar-service-type
(service-type