dotfiles/oni/home/services/emacs.scm
Tom Willemse b144e84ea5 Add ‘emacs-oni-hy’
I just added a configuration for programming in Hy. This is the first step for
moving more of my Emacs configuration into guix home. Instead of adding the
autoload for ‘oni-hy’ in the ‘oni-core’ package, I've added it directly to my
Guix configuration. In the future I'll want to change this so that each package
gets its own configuration and also extends my Emacs configuration so that it
automatically adds these autoloads when I add a package.
2023-07-14 00:54:48 -07:00

73 lines
2.4 KiB
Scheme

(define-module (oni home services emacs)
#:use-module ((gnu services configuration)
#:select (serialize-package
define-configuration
text-config?
serialize-text-config))
#:use-module ((gnu packages emacs)
#:select (emacs))
#:use-module ((gnu home services)
#:select (service-type
service-extension
home-profile-service-type
home-files-service-type))
#:use-module ((gnu home services shepherd)
#:select (shepherd-service
home-shepherd-service-type))
#:use-module ((guix gexp)
#:select (gexp
file-append
local-file
mixed-text-file))
#:use-module ((guix packages)
#:select (package?))
#:export (home-emacs-service-type
home-emacs-configuration))
(define-configuration home-emacs-configuration
(package
(package emacs)
"Package to use for setting Emacs")
(configurations
(text-config '())
"A list of other configuration files to autoload"))
(define (add-emacs-packages config)
(list (home-emacs-configuration-package config)))
(define (home-emacs-shepherd-service config)
(list
(shepherd-service
(documentation "Start Emacs")
(provision '(emacs))
(auto-start? #t)
(start
#~(make-forkexec-constructor
(list #$(file-append (home-emacs-configuration-package config) "/bin/emacs")
"--fg-daemon")
#:log-file (format #f "~a/.local/var/log/xbindkeys.log" (getenv "HOME"))))
(stop #~(make-kill-destructor)))))
(define (home-emacs-config-files config)
`((".emacs.d/init.el"
,(mixed-text-file
"init.el"
(serialize-text-config config (home-emacs-configuration-configurations config))))))
(define home-emacs-service-type
(service-type
(name 'home-emacs)
(extensions
(list (service-extension
home-profile-service-type
add-emacs-packages)
(service-extension
home-shepherd-service-type
home-emacs-shepherd-service)
(service-extension
home-files-service-type
home-emacs-config-files)))
(compose identity)
(default-value (home-emacs-configuration))
(description "Install and configure Emacs.")))