dotfiles/guix-config/home/services/emacs.scm

55 lines
2.1 KiB
Scheme

(define-module (guix-config home services emacs)
#:use-module (gnu services configuration)
#:use-module (gnu packages emacs)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (gnu services)
#:use-module (gnu home services)
#:use-module (gnu packages emacs-xyz)
#:use-module (ice-9 textual-ports) ;for get-string-all
#:export (home-emacs-service-type
home-emacs-configuration))
(define-configuration home-emacs-configuration
(emacs
(package emacs-pgtk)
"The Emacs package to use.")
(config-file
(text-config '())
"The config.el file.")
(early-config-file
(text-config '())
"The early-config.el file.")
; (emacs-packages
; (list-of-packages)
; "Emacs packages to install with emacs")
)
(define package-user-dir "~/.cache/emacs/elpa")
(define (home-emacs-files-service config)
(list `(".emacs.d/config.el"
,(mixed-text-file "config.el"
";; Emacs Config from Guix Home\n"
(call-with-input-file (home-emacs-configuration-config-file config) get-string-all)))
`(".emacs.d/early-config.el"
,(mixed-text-file "early-config.el"
";; Emacs Early Config from Guix Home\n"
(string-append "(make-directory \"" package-user-dir "\" t)\n")
(string-append "(setq package-user-dir \"" package-user-dir "\")\n")
(home-emacs-configuration-early-config-file config)))))
(define (home-emacs-profile-service config)
(list (home-emacs-configuration-emacs config)))
(define home-emacs-service-type
(service-type (name 'home-emacs)
(description "The home service to configure Emacs.")
(extensions
(list (service-extension
home-files-service-type
home-emacs-files-service)
(service-extension
home-profile-service-type
home-emacs-profile-service)))
(default-value (home-emacs-configuration))))