Emacs package

This commit is contained in:
Aleksandr Lebedev 2025-11-10 14:15:56 +01:00
parent 54ff0cc3ae
commit a16e106f98
4 changed files with 72 additions and 19 deletions

View file

@ -4,7 +4,3 @@
(setenv "PATH" (mapconcat 'identity exec-path ":")) ;;fixes direnv losing nix pkgs
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(org-babel-load-file
(expand-file-name
"config.org"
user-emacs-directory))

View file

@ -6,7 +6,6 @@
#: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))
@ -20,24 +19,23 @@
(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"
(list
`(".config/emacs/config.el"
,(mixed-text-file "config.el"
";; Emacs Config from Guix Home\n"
"(load-file \"" (home-emacs-configuration-config-file config) "\")\n"))
`(".emacs.d/early-config.el"
`(".config/emacs/init.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")
"(load-file \"" (home-emacs-configuration-early-config-file config) "\")\n"))))
"(load-file \"" (home-emacs-configuration-early-config-file config) "\")\n"
"(load-file \"~/.config/emacs/config.el\")"))))
(define (home-emacs-profile-service config)
(list (home-emacs-configuration-emacs config)))

View file

@ -29,6 +29,7 @@
#:use-module (gnu home services dotfiles)
#:use-module (gnu home services sound)
#:use-module (gnu home services desktop)
#:use-module (guix-config packages emacs)
#:use-module (guix-config home services emacs)
#:use-module (guix-config home services secretsd)
#:use-module (gnu home services niri))
@ -36,8 +37,7 @@
(home-environment
;; Below is the list of packages that will show up in your
;; Home profile, under ~/.guix-home/profile.
(packages (list emacs-pgtk
font-iosevka
(packages (list font-iosevka
git
kitty
btop
@ -85,13 +85,9 @@
(service home-secretsd-service-type)
(service home-emacs-service-type
(home-emacs-configuration
(emacs emacs-pgtk)
(emacs guixmacs)
(config-file
(local-file "./emacs/config.el"))
(early-config-file
(local-file "./emacs/init.el"))
; (emacs-packages (list
; emacs-guix))
))
)
(local-file "./emacs/init.el")))))
%base-home-services)))

View file

@ -0,0 +1,63 @@
(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)))))))))