diff options
-rw-r--r-- | dotfiles/.dmd.d/init.scm | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/dotfiles/.dmd.d/init.scm b/dotfiles/.dmd.d/init.scm index 5d59c86..f75a5e6 100644 --- a/dotfiles/.dmd.d/init.scm +++ b/dotfiles/.dmd.d/init.scm @@ -1,4 +1,6 @@ -(use-modules (ice-9 match)) +(use-modules (ice-9 match) + (srfi srfi-1) + (system repl server)) (define-syntax-rule (forever body ...) (while #t body ...)) @@ -8,6 +10,19 @@ (0 (begin body ...)) (pid pid))) +(define provided-by (@@ (dmd service) provided-by)) +(define deregister-service (@@ (dmd service) deregister-service)) + +(define deregister-service* + (compose deregister-service symbol->string)) + +(define (register-services* . services) + (for-each deregister-service* (append-map provided-by services)) + (apply register-services services)) + +(define-syntax-rule (define-service name service) + (define name (begin (register-services* service) service))) + (define (touch-file file) (close-port (open-file file "a0b"))) @@ -65,6 +80,22 @@ Ruby version, and listens on PORT." #:environment-variables (ruby-environment ruby-version name)) #:stop (make-kill-destructor))) +;; (define-service vhl-tunnel +;; (make <service> +;; #:provides '(vhl-tunnel) +;; #:requires '() +;; #:start (make-forkexec-constructor +;; '("ssh" "-N" "-L" "1234:7VWJD42.vhl.dom:22" "vhl")) +;; #:stop (make-kill-destructor))) + +;; (define-service vhl-proxy +;; (make <service> +;; #:provides '(vhl-proxy) +;; #:requires '(vhl-tunnel) +;; #:start (make-forkexec-constructor +;; '("ssh" "-N" "-D8080" "-p1234" "dthompson@localhost")) +;; #:stop (make-kill-destructor))) + (register-services ;; VHL applications (rails-service "api" "3002" "1.9.3-p551") @@ -176,8 +207,11 @@ Ruby version, and listens on PORT." #:stop (make-kill-destructor)) (simple-service "mpdscribble")) -;; Send dmd into the background +;; Send dmd into the background. (action 'dmd 'daemonize) +;; Start the REPL server. +(spawn-server (make-tcp-server-socket #:port 37148)) + ;; Services to start when dmd starts: (for-each start '(xmodmap emacs gpg-agent offlineimap)) |