commit f34e1fabfb15c4d04c315352dbc68ebde17993b0
parent 4314ed743053a9479198929a09a6936c49050d84
Author: Florian Dold <florian.dold@gmail.com>
Date: Tue, 27 Nov 2018 10:35:08 +0100
next try
Diffstat:
1 file changed, 26 insertions(+), 22 deletions(-)
diff --git a/guix/config.scm b/guix/config.scm
@@ -1,6 +1,6 @@
(use-modules
(srfi srfi-1)
- (ice-9 binary-ports)
+ (ice-9 textual-ports)
(gnu)
(guix)
(guix gexp))
@@ -8,6 +8,28 @@
(use-service-modules networking ssh version-control cgit databases admin web)
(use-package-modules base bash shells web tls)
+
+(define (absolute-file-name file directory)
+ "Return the canonical absolute file name for FILE, which lives in the
+vicinity of DIRECTORY."
+ (canonicalize-path
+ (cond ((string-prefix? "/" file) file)
+ ((not directory) file)
+ ((string-prefix? "/" directory)
+ (string-append directory "/" file))
+ (else file))))
+
+(define (deployment-file-name file)
+ (absolute-file-name file (current-source-directory))
+
+(define (concat-local-files outname files)
+ (define (slurp f)
+ (call-with-input-file (deployment-file-name f) get-string-all)))
+ (define (file-concat files)
+ (string-concatenate (map slurp files)))
+ (plain-file outname (file-concat files)))
+
+
;;; --- cron jobs start
(define %certbot-job
;; LE cert renewal 7d / 2
@@ -52,26 +74,6 @@
(copy-file #$(local-file "etc/nginx/sites-enabled/default.site")
"sites-enabled/default.site")))))
-(define (concat-local-files outname files)
- (computed-file
- outname
- (with-imported-modules
- '((ice-9 binary-ports))
- #~(begin
- (use-modules (ice-9 binary-ports))
- (define (concat-ports pi po)
- (unless (port-eof? pi)
- (let ((chunk (get-bytvector-some pi)))
- (put-bytevector po chunk)
- (concat-ports pi po))))
- (define (concat-to-output src)
- (call-with-output-file #$output
- (lambda (po)
- (call-with-input-file #$(local-file src)
- (lambda (pi)
- (concat-ports pi po))))))
- (for-each concat-to-output '#$files)))))
-
;; this includes defaults, so 'fastcgi' related files:
(define %nginx-mime-types
(simple-service 'nginx-mime.types
@@ -206,7 +208,9 @@
'("keys/ssh/grothoff.pub"
"keys/ssh/ng0.pub"
"keys/ssh/dold.pub"
- "keys/ssh/stanisci.pub")))))))
+ "keys/ssh/stanisci.pub")))
+ ("dold" ,(local-file "keys/ssh/dold.pub"))
+ ("grothoff" ,(local-file "keys/ssh/grothoff.pub")))))
;; (service rottlog-service-type (rottlog-configuration))
;; (service mcron-service-type