diff options
-rw-r--r-- | container.scm | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/container.scm b/container.scm index ea5083b..8752b9d 100644 --- a/container.scm +++ b/container.scm @@ -678,8 +678,53 @@ exim_path = /run/setuid-programs/exim (semantic-checks? #t) (notify (map car %1984-freedns-nameservers)))) +(define knot-configuration-knot + (@@ (gnu services dns) knot-configuration-knot)) + +(define knot-config-file + (@@ (gnu services dns) knot-config-file)) + +(define (knot-config-file-with-logging knot-config) + (computed-file "knot-with-logging.conf" + #~(with-output-to-file #$output + (lambda _ + (use-modules (ice-9 textual-ports)) + (call-with-input-file #$(knot-config-file knot-config) + (lambda (port) + (display (get-string-all port)))) + (newline) + (display "\ +log: + - target: syslog +"))))) + +(define (adapt-knot-shepherd-extension ext) + ;; Make knot daemon log to syslog. + (let ((old-activation (service-extension-compute ext))) + (define (new-activation knot-config) + (let* ((knot-package (knot-configuration-knot knot-config)) + (config-file (knot-config-file-with-logging knot-config))) + (map (lambda (shepherd-service-record) + (shepherd-service + (inherit shepherd-service-record) + (start #~(make-forkexec-constructor + '(#$(file-append knot-package "/sbin/knotd") + "-c" #$config-file))))) + (old-activation knot-config)))) + + (service-extension shepherd-root-service-type new-activation))) + +(define koszko-knot-service-type + (service-type + (inherit knot-service-type) + (extensions (map (lambda (ext) + (if (extension-of-type? ext shepherd-root-service-type) + (adapt-knot-shepherd-extension ext) + ext)) + (service-type-extensions knot-service-type))))) + (define %koszko-knot-service - (service knot-service-type + (service koszko-knot-service-type (knot-configuration (acls (list (knot-acl-configuration (id "allow-axfr-from-1984") |