From 8875ac474926e59826ea3ddb0c7c07d9a38dfdaf Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 10 Mar 2022 16:20:44 +0530 Subject: services: databases: Prefer (guix records) to define-configuration. define-configuration does too much magic. * gn/services/databases.scm (): Redefine using (guix records). Export virtuoso-configuration?. (virtuoso-shepherd-service): Represent a disabled port with #f. --- gn/services/databases.scm | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'gn/services') diff --git a/gn/services/databases.scm b/gn/services/databases.scm index 7d0d1f0..2a995d7 100644 --- a/gn/services/databases.scm +++ b/gn/services/databases.scm @@ -5,7 +5,9 @@ #:use-module (gnu services configuration) #:use-module (gnu services shepherd) #:use-module (guix packages) + #:use-module (guix records) #:export (virtuoso-configuration + virtuoso-configuration? virtuoso-configuration-package virtuoso-configuration-http-server-port virtuoso-service-type)) @@ -14,19 +16,13 @@ ;;; 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-record-type* + virtuoso-configuration make-virtuoso-configuration + virtuoso-configuration? + (package virtuoso-configuration-package + (default virtuoso-ose)) + (http-server-port virtuoso-configuration-http-server-port + (default 8890))) (define %virtuoso-accounts (list (user-group (name "virtuoso") @@ -53,8 +49,7 @@ "virtuoso.ini" #~(call-with-output-file #$output (lambda (port) - (when (not (eq? #$(virtuoso-configuration-http-server-port config) - 'disabled)) + (when #$(virtuoso-configuration-http-server-port config) (format port "[HTTPServer]~%") (format port "ServerPort = ~a~%" #$(virtuoso-configuration-http-server-port config))))))) -- cgit v1.2.3