From a9e3aa8a44e5394e90509db5ed0f237369ad94dd Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 9 Jan 2024 14:56:19 +0000 Subject: 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. --- guix/forge/laminar.scm | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'guix') 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{} 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 -- cgit v1.2.3