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.
This commit is contained in:
Arun Isaac 2021-05-31 00:41:06 +05:30
parent de949bac61
commit 0d2cbd6632
No known key found for this signature in database
GPG key ID: 2E25EE8B61802BB3

View file

@ -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 @@ (define (laminar-account config)
(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.")))