summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-01-22 23:42:15 +0100
committerLudovic Courtès <ludo@gnu.org>2015-01-22 23:42:15 +0100
commit0a0517690dd0f65aed5f21cc7976119608ff2577 (patch)
tree0c724ade7e9e7bab4ecdfc87cf3a308deea070e1 /gnu
parentb6c5a39701e8312b3f80509275d91e26ee03f3c9 (diff)
downloadguix-0a0517690dd0f65aed5f21cc7976119608ff2577.tar.gz
system: Create /etc/emacs/site-start.el.
* gnu/system.scm (emacs-site-file, emacs-site-directory): New
  procedures.
  (etc-directory): Add 'EMACSLOADPATH' setting to PROFILE.  Call
  'emacs-site-directory', and bind its result to /etc/emacs.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system.scm35
1 files changed, 35 insertions, 0 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 78c63bb477..bb11189e8f 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -372,6 +372,36 @@ This is the GNU system.  Welcome.\n")
   "Return the default /etc/hosts file."
   (text-file "hosts" (local-host-aliases host-name)))
 
+(define (emacs-site-file)
+  "Return the Emacs 'site-start.el' file.  That file contains the necessary
+settings for 'guix.el' to work out-of-the-box."
+  (gexp->file "site-start.el"
+              #~(progn
+                 ;; Add the "normal" elisp directory to the search path;
+                 ;; guix.el may be there.
+                 (add-to-list
+                  'load-path
+                  "/run/current-system/profile/share/emacs/site-lisp")
+
+                 ;; Attempt to load guix.el.
+                 (require 'guix-init nil t)
+
+                 (when (require 'geiser-guile nil t)
+                   ;; Make sure Geiser's Scheme modules are in Guile's search
+                   ;; path.
+                   (add-to-list
+                    'geiser-guile-load-path
+                    "/run/current-system/profile/share/geiser/guile")))))
+
+(define (emacs-site-directory)
+  "Return the Emacs site directory, aka. /etc/emacs."
+  (mlet %store-monad ((file (emacs-site-file)))
+    (gexp->derivation "emacs"
+                      #~(begin
+                          (mkdir #$output)
+                          (chdir #$output)
+                          (symlink #$file "site-start.el")))))
+
 (define* (etc-directory #:key
                         (locale "C") (timezone "Europe/Paris")
                         (issue "Hello!\n")
@@ -390,6 +420,7 @@ This is the GNU system.  Welcome.\n")
 /bin/sh
 /run/current-system/profile/bin/sh
 /run/current-system/profile/bin/bash\n"))
+       (emacs      (emacs-site-directory))
        (issue      (text-file "issue" issue))
 
        ;; For now, generate a basic config so that /etc/hosts is honored.
@@ -410,12 +441,16 @@ export PATH=$HOME/.guix-profile/bin:/run/current-system/profile/bin
 export PATH=/run/setuid-programs:/run/current-system/profile/sbin:$PATH
 export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
 export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
+
+# Append the directory of 'site-start.el' to the search path.
+export EMACSLOADPATH=:/etc/emacs
 "))
        (skel      (skeleton-directory skeletons)))
     (file-union "etc"
                 `(("services" ,#~(string-append #$net-base "/etc/services"))
                   ("protocols" ,#~(string-append #$net-base "/etc/protocols"))
                   ("rpc" ,#~(string-append #$net-base "/etc/rpc"))
+                  ("emacs" ,#~#$emacs)
                   ("pam.d" ,#~#$pam.d)
                   ("login.defs" ,#~#$login.defs)
                   ("issue" ,#~#$issue)