81 lines
3 KiB
Scheme
81 lines
3 KiB
Scheme
(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-config
|
||
(local-file "./config.org"))
|
||
|
||
(define emacs-init
|
||
(mixed-text-file "init.el"
|
||
";;; -*- lexical-binding: t; -*-
|
||
(require 'package)
|
||
;;https://github.com/wbolster/emacs-direnv/issues/85
|
||
(setenv \"PATH\" (mapconcat 'identity exec-path \":\")) ;;fixes direnv losing nix/guix pkgs
|
||
(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t)
|
||
(package-initialize)
|
||
(org-babel-load-file
|
||
\"" emacs-config "\")
|
||
"))
|
||
|
||
(define emacs-pkgs
|
||
(list emacs-guix ripgrep))
|
||
|
||
(define guixmacs
|
||
(package
|
||
(name "guixmacs")
|
||
(version (package-version emacs-pgtk))
|
||
(source #f)
|
||
(synopsis "KyleKrein’s 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 " -l " #$emacs-init " $@\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)
|
||
;(mkdir-p (string-append out "/native-lisp"))
|
||
(symlink (string-append emacs "/share") (string-append out "/share"))
|
||
(symlink (string-append emacs "/native-lisp") (string-append out "/native-lisp"))
|
||
(wrap-external-program
|
||
(string-append emacs "/bin/emacs")
|
||
(string-append out "/bin/emacs")
|
||
(list (cons "EMACSLOADPATH" emacsloadpath)
|
||
(cons "PATH" path)))))))))
|