dotfiles/guix-config/packages/emacs.scm
2025-11-10 14:15:56 +01:00

63 lines
2.4 KiB
Scheme
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(define-module (guix-config packages emacs)
#:use-module (gnu packages emacs)
#:use-module (gnu packages emacs-xyz)
#:use-module (gnu packages rust-apps)
#:use-module (gnu packages bash)
#:use-module (guix build utils)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix gexp)
#:use-module (guix licenses)
#:use-module (guix build-system trivial)
#:export (guixmacs))
(define emacs-pkgs
(list emacs-guix ripgrep))
(define guixmacs
(package
(name "guixmacs")
(version (package-version emacs-pgtk))
(source #f)
(synopsis "KyleKreins Emacs config wrapper")
(description "Emacs PGTK wrapped with useful Guix packages in PATH and EMACSLOADPATH.")
(license gpl3+)
(home-page "https://git.kylekrein.com/kylekrein/dotfiles")
(build-system trivial-build-system)
(propagated-inputs (append (list emacs-pgtk
bash-minimal)
emacs-pkgs))
(arguments
(list
#:modules '((guix build utils))
#:builder
#~(begin
(use-modules (guix build utils))
(define (wrap-external-program target out-bin env-vars)
(let ((script (open-output-file out-bin)))
(display (string-append "#!" #$bash-minimal "/bin/bash" "\n") script)
(for-each
(lambda (pair)
(display (string-append "export " (car pair) "=\"" (cdr pair) "\"\n") script))
env-vars)
(display (string-append "\"" target "\" \"$@\"\n") script)
(close-output-port script))
(chmod out-bin #o755))
(let* ((out #$output)
(emacs #$(this-package-input "emacs-pgtk"))
(dep-paths '#$emacs-pkgs)
(site-lisps (map (lambda (p)
(string-append p "/share/emacs/site-lisp"))
dep-paths))
(bins (map (lambda (p)
(string-append p "/bin"))
dep-paths))
(bin (string-append out "/bin"))
(emacsloadpath (string-join site-lisps ":"))
(path (string-join (append (list "$PATH") bins) ":")))
(mkdir-p bin)
(wrap-external-program
(string-append emacs "/bin/emacs")
(string-append out "/bin/emacs")
(list (cons "EMACSLOADPATH" emacsloadpath)
(cons "PATH" path)))))))))