services: home-emacs: Use load-profile from (guix profiles).

* modules/rosenthal/home/services/emacs.scm (home-emacs-package): Use
‘load-profile’ for home-emacs-program and simplify.
This commit is contained in:
Hilton Chain committed 2026-11-24 11:17:52 +08:00
1 parent a6736d8030
commit fff737cc07
1 file changed
+11 -31
+11 -31
View File
@@ -10,7 +10,7 @@
#:use-module (guix packages)
#:use-module (guix profiles)
#:use-module (guix records)
#:use-module (guix search-paths)
#:autoload (guix self) (make-config.scm)
;; Guix System - services
#:use-module (gnu services)
#:use-module (gnu services configuration)
@@ -45,41 +45,21 @@ of Emacs extensions.")
(content (manifest
(cons (package->manifest-entry emacs)
(manifest-entries packages))))))
(home-emacs-search-paths
(map search-path-specification->sexp
(manifest-search-paths
(profile-content home-emacs-profile))))
(home-emacs-program
(program-file "home-emacs-program"
(with-imported-modules
(source-module-closure
'((guix search-paths)
(guix build utils)))
(cons `((guix config) => ,(make-config.scm))
(delete '(guix config)
(source-module-closure '((guix profiles)))))
#~(begin
(use-modules (ice-9 match)
(guix search-paths)
(guix build utils))
(let ((profile #$home-emacs-profile))
;; See also (@ (guix profiles) load-profile).
(for-each
(match-lambda
((($ <search-path-specification> variable _ separator) . value)
(let ((current (getenv variable)))
(setenv variable
(if current
(if separator
(string-append value separator current)
value)
value)))))
(evaluate-search-paths
(map sexp->search-path-specification
'#$home-emacs-search-paths)
(list profile)))
(match (command-line)
((cmd . args)
(apply system*
(string-append profile "/bin/" (basename cmd))
args)))))))))
(guix profiles))
(load-profile #$home-emacs-profile)
(match (command-line)
((cmd . args)
(apply system*
(string-append #$home-emacs-profile "/bin/" (basename cmd))
args))))))))
(package
(inherit emacs)
(name "emacs-wrapper")