summary refs log tree commit diff
path: root/gnu/services/ci.scm
diff options
context:
space:
mode:
authorArun Isaac <arunisaac@systemreboot.net>2021-05-31 00:41:06 +0530
committerArun Isaac <arunisaac@systemreboot.net>2021-06-10 09:58:20 +0530
commit0d2cbd663214a8aa4ed8b8c7716fe3436801a9a5 (patch)
treed78c7900d2bb5dc4644f80a545b1d6a3f7351ab2 /gnu/services/ci.scm
parentde949bac61b66209cf952028be4570c9dd84c7b0 (diff)
downloadguix-0d2cbd663214a8aa4ed8b8c7716fe3436801a9a5.tar.gz
services: laminar: Create parent directory for unix socket.
* gnu/services/ci.scm (laminar-activation): New function.
(laminar-service-type): Extend activation-service-type with
laminar-activation.
Diffstat (limited to 'gnu/services/ci.scm')
-rw-r--r--gnu/services/ci.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/gnu/services/ci.scm b/gnu/services/ci.scm
index 0b18521e76..0c3566bcaf 100644
--- a/gnu/services/ci.scm
+++ b/gnu/services/ci.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018, 2019, 2020, 2021 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -115,13 +116,25 @@
          (home-directory (laminar-configuration-home-directory config))
          (shell #~(string-append #$shadow "/sbin/nologin")))))
 
+(define (laminar-activation config)
+  (let ((bind-http (laminar-configuration-bind-http config)))
+    #~(begin
+        ;; If listen is a unix socket, create its parent directory.
+        (when (string-prefix? "unix:" #$bind-http)
+          (let ((run-directory
+                 (dirname (substring #$bind-http (string-length "unix:"))))
+                (user (getpw "laminar")))
+            (mkdir-p run-directory)
+            (chown run-directory (passwd:uid user) (passwd:gid user)))))))
+
 (define laminar-service-type
   (service-type
    (name 'laminar)
    (extensions
     (list
      (service-extension shepherd-root-service-type laminar-shepherd-service)
-     (service-extension account-service-type laminar-account)))
+     (service-extension account-service-type laminar-account)
+     (service-extension activation-service-type laminar-activation)))
    (default-value (laminar-configuration))
    (description
     "Run the Laminar continuous integration service.")))