Paste number 348336: service auto-start

Paste number 348336: service auto-start
Pasted by: snape
When:4 years, 5 months ago
Share:Tweet this! | http://paste.lisp.org/+7GS0
Channel:None
Paste contents:
Raw Source | XML | Display As
(define my-nginx-configuration
  (nginx-configuration
   (server-blocks
    (list
     (nginx-server-configuration
      (server-name (list "localhost"))
      (root "/var/www")
      (ssl-certificate #f)
      (ssl-certificate-key #f)
      (locations
       (list
        (nginx-location-configuration
         (uri "/")
         (body (list "index index.html;"))))))))))

(define (my-nginx-shepherd-service nginx-conf)
  (let ((nginx-shepherd-service
         (service-extension-compute
          (find (lambda (ext)
                  (eq? (service-extension-target ext)
                       shepherd-root-service-type))
                (service-type-extensions nginx-service-type)))))
    (list
     (shepherd-service
      (inherit (car (nginx-shepherd-service nginx-conf)))
      (auto-start? #f)))))

(define my-nginx-service-type
  (service-type
   (inherit nginx-service-type)
   (extensions
    (cons
     (service-extension shepherd-root-service-type
                        my-nginx-shepherd-service)
     (remove (lambda (ext)
               (eq? (service-extension-target ext)
                    shepherd-root-service-type))
             (service-type-extensions nginx-service-type))))))

(define %my-nginx-service
  (service my-nginx-service-type my-nginx-configuration))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.