diff --git a/guix-config/home/emacs/init.el b/guix-config/home/emacs/init.el index d6623e2..f507065 100644 --- a/guix-config/home/emacs/init.el +++ b/guix-config/home/emacs/init.el @@ -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)) diff --git a/guix-config/home/services/emacs.scm b/guix-config/home/services/emacs.scm index aff24fe..4c09758 100644 --- a/guix-config/home/services/emacs.scm +++ b/guix-config/home/services/emacs.scm @@ -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))) diff --git a/guix-config/home/workstation.scm b/guix-config/home/workstation.scm index 2f16108..1a06003 100644 --- a/guix-config/home/workstation.scm +++ b/guix-config/home/workstation.scm @@ -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))) diff --git a/guix-config/packages/emacs.scm b/guix-config/packages/emacs.scm new file mode 100644 index 0000000..12a6ca0 --- /dev/null +++ b/guix-config/packages/emacs.scm @@ -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 "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 "\" \"$@\"\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)))))))))