blob: 7d0d1f064c5f30cc27a6a5b98e106cfb7e59f4be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
(define-module (gn services databases)
#:use-module (gnu)
#:use-module (gnu packages admin)
#:use-module (gnu packages databases)
#:use-module (gnu services configuration)
#:use-module (gnu services shepherd)
#:use-module (guix packages)
#:export (virtuoso-configuration
virtuoso-configuration-package
virtuoso-configuration-http-server-port
virtuoso-service-type))
;;;
;;; Virtuoso
;;;
(define-maybe non-negative-integer)
(define (non-negative-integer? val)
(and (integer? val)
(not (negative? val))))
(define-configuration virtuoso-configuration
(package
(package virtuoso-ose)
"The virtuoso package.")
(http-server-port
(maybe-non-negative-integer 'disabled)
"The port on which to listen for HTTP connections."))
(define %virtuoso-accounts
(list (user-group (name "virtuoso")
(system? #t))
(user-account
(name "virtuoso")
(group "virtuoso")
(system? #t)
(comment "Virtuoso user")
(home-directory "/var/lib/virtuoso")
(shell (file-append shadow "/sbin/nologin")))))
(define (virtuoso-shepherd-service config)
(shepherd-service
(documentation "Run Virtuoso.")
(provision '(virtuoso))
(requirement '(networking))
(start #~(make-forkexec-constructor
(list #$(file-append (virtuoso-configuration-package config)
"/bin/virtuoso-t")
"+foreground"
"+configfile"
#$(computed-file
"virtuoso.ini"
#~(call-with-output-file #$output
(lambda (port)
(when (not (eq? #$(virtuoso-configuration-http-server-port config)
'disabled))
(format port "[HTTPServer]~%")
(format port "ServerPort = ~a~%"
#$(virtuoso-configuration-http-server-port config)))))))
#:directory "/var/lib/virtuoso"
#:user "virtuoso"
#:group "virtuoso"))
(stop #~(make-kill-destructor))))
(define virtuoso-service-type
(service-type
(name 'virtuoso)
(description "Run Virtuoso.")
(extensions
(list (service-extension account-service-type
(const %virtuoso-accounts))
(service-extension shepherd-root-service-type
(compose list virtuoso-shepherd-service))))
(default-value (virtuoso-configuration))))
|