mirror of
https://gitlab.univ-nantes.fr/glicid-public/guix-glicid.git
synced 2025-04-29 21:58:36 +02:00
adding forgejo service
This commit is contained in:
parent
8964a0c26b
commit
fc4cf9e17b
1 changed files with 79 additions and 0 deletions
79
glicid/services/forgejo.scm
Normal file
79
glicid/services/forgejo.scm
Normal file
|
@ -0,0 +1,79 @@
|
|||
(define-module (glicid services forgejo)
|
||||
#:use-module (glicid packages forgejo)
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services shepherd)
|
||||
#:use-module (gnu system shadow)
|
||||
#:use-module (gnu system pam)
|
||||
#:use-module (gnu packages admin)
|
||||
#:use-module (gnu packages base)
|
||||
#:use-module (gnu packages certs)
|
||||
#:use-module (gnu packages version-control)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix modules)
|
||||
#:use-module (guix records)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (forgejo-configuration
|
||||
forgejo-configuration?
|
||||
forgejo-service
|
||||
forgejo-service-type
|
||||
%forgejo-account
|
||||
%forgejo-group
|
||||
%forgejo-accounts))
|
||||
|
||||
(define %forgejo-group
|
||||
(user-group
|
||||
(name "forgejo")
|
||||
(system? #t)))
|
||||
|
||||
(define %forgejo-account
|
||||
(user-account
|
||||
(name "forgejo")
|
||||
(group "forgejo")
|
||||
(system? #t)
|
||||
(comment "forgejo server user")
|
||||
(home-directory "/var/lib/forgejo")
|
||||
(shell (file-append bash "/bin/bash"))))
|
||||
|
||||
(define %forgejo-accounts
|
||||
(list %forgejo-group %forgejo-account))
|
||||
|
||||
(define-record-type* <forgejo-configuration> forgejo-configuration
|
||||
make-forgejo-configuration
|
||||
forgejo-configuration?
|
||||
(forgejo forgejo (default forgejo))
|
||||
(forgejo-conf forgejo-conf (default "/etc/forgejo/app.ini"))
|
||||
(log-file log-file (default "/var/log/forgejo.log")))
|
||||
|
||||
(define %forgejo-activation
|
||||
#~(begin
|
||||
(mkdir-p "/etc/forgejo")
|
||||
(touch "/etc/forgejo/app.ini")
|
||||
(touch "/var/log/forgejo.log")
|
||||
(chown "/etc/forgejo" (passwd:uid "forgejo") (passwd:gid "forgejo"))
|
||||
(chown "/etc/forgejo/app.ini" (passwd:uid "forgejo") (passwd:gid "forgejo"))
|
||||
(chown "/var/log/forgejo.log" (passwd:uid "forgejo") (passwd:gid "forgejo"))
|
||||
#t))
|
||||
|
||||
|
||||
(define forgejo-service
|
||||
(match-lambda
|
||||
(($ <forgejo-configuration> forgejo forgejo-conf log-file)
|
||||
(list (shepherd-service (provision '(forgejo))
|
||||
(documentation "Run forgejo.")
|
||||
(requirement '(user-processes))
|
||||
(respawn? #t)
|
||||
(start #~(make-forkexec-constructor (list #$(file-append forgejo "/bin/forgejo")
|
||||
"web"
|
||||
"--config" forgejo-conf)
|
||||
#:log-file #$log-file
|
||||
#:user (passwd:uid (getpwnam "forgejo"))
|
||||
#:group (passwd:gid (getpwnam "forgejo"))))
|
||||
(stop #~(make-kill-destructor)))))))
|
||||
|
||||
(define forgejo-service-type
|
||||
(service-type (name 'forgejo)
|
||||
(extensions (list (service-extension shepherd-root-service-type forgejo-service)
|
||||
(service-extension activation-service-type (const %forgejo-activation))
|
||||
(service-extension account-service-type (const %forgejo-accounts))))
|
||||
(description "Run forgejo")
|
||||
))
|
Loading…
Add table
Reference in a new issue