From 0a0517690dd0f65aed5f21cc7976119608ff2577 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 22 Jan 2015 23:42:15 +0100 Subject: 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. --- gnu/system.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'gnu') 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) -- cgit v1.2.3