~whereiseveryone/guixrus

5104909976c7f67881233d2ff2bf52249a3aa162 — ( 1 year, 3 months ago 4037eb4
fix(home): final tweaks and fixes for HOME-EMACS-SERVICE-TYPE

Removes the lazy-start feature of HOME-EMACS-SERVICE-TYPE; it seemed to be
breaking the service after I restarted.  Also makes a few final stylistic
tweaks.
1 files changed, 20 insertions(+), 39 deletions(-)

M guixrus/home/services/emacs.scm
M guixrus/home/services/emacs.scm => guixrus/home/services/emacs.scm +20 -39
@@ 24,7 24,6 @@
  #:use-module (gnu services configuration)
  #:use-module (guix derivations)
  #:use-module (guix gexp)
  #:use-module (guix modules)
  #:use-module (guix monads)
  #:use-module (guix profiles)
  #:use-module (guix records)


@@ 42,8 41,7 @@

(define file-like-or-#f?
  (match-lambda
    ((or #f
         (? file-like?)) #t)
    ((or #f (? file-like?)) #t)
    (_ #f)))

(define-configuration/no-serialization home-emacs-configuration


@@ 96,15 94,6 @@ EMACS-MINIMAL.")
     (content (packages->manifest (cons (emacs-for-compile config)
                                        packages))))))

(define not-config?
  ;; Select (guix …) and (gnu …) modules, except (guix config).
  (match-lambda
    (('guix 'config) #f)
    ((or ('gnu rest ...)
         ('guix rest ...))
     #t)
    (rest #f)))

(define (build-emacs-profile config)
  (with-store store
    (run-with-store store


@@ 118,27 107,24 @@ EMACS-MINIMAL.")
                              "out"))))))))

(define (emacs-environment config)
  (with-imported-modules (source-module-closure '((guix search-paths)))
    #~(begin
        (use-modules (guix search-paths))
        (map (lambda (env-var)
               (let ((variable (list-ref env-var 0))
                     (separator (list-ref env-var 1))
                     (value (list-ref env-var 2)))
                 (string-append variable "="
                                (or (and=> (getenv variable)
                                           (lambda (original)
                                             (string-append original
                                                            separator)))
                                    "")
                                value)))
             '(#$@(map (match-lambda
                         ((spec . value)
                          (match-record spec <search-path-specification>
                              (variable separator)
                            (list variable separator value))))
                       (profile-search-paths
                        (build-emacs-profile config))))))))
  #~(map (lambda (env-var)
           (let ((variable (list-ref env-var 0))
                 (separator (list-ref env-var 1))
                 (value (list-ref env-var 2)))
             (string-append variable "="
                            (or (and=> (getenv variable)
                                       (lambda (original)
                                         (string-append original
                                                        separator)))
                                "")
                            value)))
         '(#$@(map (match-lambda
                     ((spec . value)
                      (match-record spec <search-path-specification>
                          (variable separator)
                        (list variable separator value))))
                   (profile-search-paths
                    (build-emacs-profile config))))))

(define (home-emacs-profile-packages config)
  (match-record config <home-emacs-configuration> (emacs)


@@ 154,17 140,12 @@ EMACS-MINIMAL.")
             (string-append "Start the Emacs server called "
                            server "."))
            (start
             #~(make-systemd-constructor
             #~(make-forkexec-constructor
                (list #$(file-append emacs "/bin/emacs")
                      (string-append "--fg-daemon=" #$server)
                      #$@(if debug?
                             (list "--debug-init")
                             '()))
                (list (endpoint
                       (make-socket-address
                        AF_UNIX
                        (format #f "/run/user/~a/emacs/~a"
                                (getuid) #$server))))
                #:log-file
                (format #f "~a/log/emacs/~a.log"
                        (or (getenv "XDG_STATE_HOME")