From 16b82d6fbc99123d57c80f03cfa00db551088d7f Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 15 Nov 2022 15:19:13 -0600 Subject: [PATCH] removing straight and using nix --- README.org | 37 ++++++++++++++++++++++------------ init.el | 58 +++++++++--------------------------------------------- recentf | 2 +- 3 files changed, 34 insertions(+), 63 deletions(-) diff --git a/README.org b/README.org index 3da0405a..9f545b27 100644 --- a/README.org +++ b/README.org @@ -201,8 +201,17 @@ Let's also set org-mode as the scratch buffer mode #+end_src ** Let's bootstrap straight.el -To use straight we need to bootstrap it. This code is pulled right from Straight's github repo. +Before bootstrapping straight, I've begun to move more and more of my configurations into Nix. To ensure that the packages used by Nix are loaded and straight defers to that, let's make sure they are found in the load path first. #+begin_src emacs-lisp +(dolist (path load-path) + (when (string-match-p "/nix/store/[a-z0-9]\\{32\\}-emacs-packages-deps.*" path) + (dolist (autoload-file (directory-files path t "-autoloads.el")) + (with-demoted-errors "init.el error: %s" + (load autoload-file nil t))))) +#+end_src + +To use straight we need to bootstrap it. This code is pulled right from Straight's github repo. +#+begin_src emacs-lisp :tangle no (setq straight-fix-org t) (setq straight-check-for-modifications '(check-on-save find-when-checking)) (defvar bootstrap-version) @@ -221,6 +230,14 @@ To use straight we need to bootstrap it. This code is pulled right from Straight (setq straight-use-package-by-default t) (straight-use-package 'use-package) +#+end_src + +Now, let's turn on =use-package=. +#+begin_src emacs-lisp +(eval-when-compile (require 'use-package)) +#+end_src + +,#+begin_src emacs-lisp (setq use-package-verbose t) (defalias 'yes-or-no-p 'y-or-n-p) #+end_src @@ -583,7 +600,6 @@ This is the use-package definition with a lot of customization. Need to setup au Part of this config includes some special capture templates for my work as a youth minister. I create lessons through both org-mode and org-roam capture templates. The first part comes from org-roam, then the next is org-mode. #+begin_src emacs-lisp (use-package org - :straight t :defer 1 :config (setq org-startup-indented t @@ -901,7 +917,6 @@ In order to use it, I need to go to http://localhost:8080 #+BEGIN_SRC emacs-lisp (use-package websocket) (use-package org-roam-ui - :straight (:host github :repo "org-roam/org-roam-ui" :files ("*.el" "out")) :after org-roam :config (setq org-roam-ui-sync-theme t @@ -952,7 +967,6 @@ Org-Superstar makes the stars at the beginning of the line in =org-mode= a lot p *** Org Modern #+BEGIN_SRC emacs-lisp (use-package org-modern - :straight (:host github :repo "minad/org-modern") :config (custom-set-faces @@ -2062,6 +2076,10 @@ Let's give eglot a try. (c++-mode . eglot)) #+end_src +#+begin_src emacs-lisp +(use-package consult-eglot) +#+end_src + *** CMAKE #+begin_src emacs-lisp (use-package cmake-mode @@ -2077,7 +2095,7 @@ I use fennel to build my awesomewm config. So, we'll need that downloaded. *** Friar Friar is a fennel repl in the awesome repl. It allows you to interact with AwesomeWM from inside emacs. -#+begin_src emacs-lisp +#+begin_src emacs-lisp :tangle no (use-package friar :straight (:host github :repo "warreq/friar" :branch "master" :files (:defaults "*.lua" "*.fnl")) @@ -2177,7 +2195,6 @@ I may get into flutter development over using felgo..... but i'm not happy about "gr" 'flutter-run-or-hot-reload "gR" 'lsp-dart-dap-flutter-hot-restart)) -(use-package lsp-dart) (use-package flutter :after dart :general @@ -2205,7 +2222,6 @@ I'm making a small function in here to open files in the appropriate program usi #+begin_src emacs-lisp (use-package dired :ensure nil - :straight nil :config (defun chris/dired-open-xdg () "Open the file-at-point in the appropriate program" @@ -2366,7 +2382,6 @@ Ledger mode #+begin_src emacs-lisp (use-package mu4e :load-path "/usr/share/emacs/site-lisp/mu4e/" - :straight nil :init (setq mu4e-maildir "~/Maildir" user-full-name "Chris Cochrun" @@ -2680,7 +2695,6 @@ Let's add our own eshell prompt. and set the password cache to a significantly h #+begin_src emacs-lisp (use-package eshell :ensure nil - :straight nil :config (require 'em-tramp) @@ -2832,7 +2846,6 @@ Using sly makes a lot better common-lisp interaction within emacs. Let's use pdf-tools for a lot better interaction with pdfs. #+begin_src emacs-lisp (use-package pdf-tools - :straight nil :mode ("\\.pdf\\'" . pdf-view-mode) :init ;; (setq pdf-info-epdfinfo-program "/nix/store/6pc8vs42xbfah1h8h050a77p7vpr12kc-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20220823/epdfinfo" @@ -3216,11 +3229,9 @@ I like to keep my passwords in password-store for a very unixy way of doing thin ** Matrix/Ement Matrix.el is a decent enough matrix client built in emacs. Like it. #+begin_src emacs-lisp -(use-package plz - :straight (plz :type git :host github :repo "alphapapa/plz.el")) +(use-package plz) (use-package ement - :straight (ement :type git :host github :repo "alphapapa/ement.el") :config (setq ement-room-images t ement-save-sessions t) diff --git a/init.el b/init.el index b201c83f..f3b5144b 100644 --- a/init.el +++ b/init.el @@ -88,26 +88,13 @@ (setq initial-major-mode 'org-mode) (setq initial-scratch-message "#+TITLE: SCRATCH\n#+DESCRIPTION: This buffer is for temporary things") -(setq straight-fix-org t) -(setq straight-check-for-modifications '(check-on-save find-when-checking)) -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) +(dolist (path load-path) + (when (string-match-p "/nix/store/[a-z0-9]\\{32\\}-emacs-packages-deps.*" path) + (dolist (autoload-file (directory-files path t "-autoloads.el")) + (with-demoted-errors "init.el error: %s" + (load autoload-file nil t))))) -(setq straight-use-package-by-default t) - -(straight-use-package 'use-package) -(setq use-package-verbose t) -(defalias 'yes-or-no-p 'y-or-n-p) +(eval-when-compile (require 'use-package)) (use-package command-log-mode :commands command-log-mode) @@ -344,7 +331,6 @@ visual-fill-column-center-text t)) (use-package org - :straight t :defer 1 :config (setq org-startup-indented t @@ -632,7 +618,6 @@ (use-package websocket) (use-package org-roam-ui - :straight (:host github :repo "org-roam/org-roam-ui" :files ("*.el" "out")) :after org-roam :config (setq org-roam-ui-sync-theme t @@ -661,7 +646,6 @@ )) (use-package org-modern - :straight (:host github :repo "minad/org-modern") :config (custom-set-faces @@ -1400,17 +1384,14 @@ targets." :hook (c++-mode . eglot)) +(use-package consult-eglot) + (use-package cmake-mode :mode ("\\CMakeLists.txt\\'" . cmake-mode)) (use-package fennel-mode :mode ("\\.fnl\\'" . fennel-mode)) -(use-package friar - :straight (:host github :repo "warreq/friar" :branch "master" - :files (:defaults "*.lua" "*.fnl")) - :after fennel-mode) - (use-package yaml-mode :mode ("\\.yml\\'" . yaml-mode)) @@ -1465,7 +1446,6 @@ targets." "gr" 'flutter-run-or-hot-reload "gR" 'lsp-dart-dap-flutter-hot-restart)) -(use-package lsp-dart) (use-package flutter :after dart :general @@ -1482,7 +1462,6 @@ targets." (use-package dired :ensure nil - :straight nil :config (defun chris/dired-open-xdg () "Open the file-at-point in the appropriate program" @@ -1570,7 +1549,6 @@ targets." (use-package mu4e :load-path "/usr/share/emacs/site-lisp/mu4e/" - :straight nil :init (setq mu4e-maildir "~/Maildir" user-full-name "Chris Cochrun" @@ -1844,7 +1822,6 @@ targets." (use-package eshell :ensure nil - :straight nil :config (require 'em-tramp) @@ -1985,7 +1962,6 @@ targets." (sly-connect "localhost" 4006))) (use-package pdf-tools - :straight nil :mode ("\\.pdf\\'" . pdf-view-mode) :init ;; (setq pdf-info-epdfinfo-program "/nix/store/6pc8vs42xbfah1h8h050a77p7vpr12kc-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20220823/epdfinfo" @@ -2319,11 +2295,9 @@ interfere with the default `bongo-playlist-buffer'." (chris/leader-keys "st" 'password-store-otp-token-copy)) -(use-package plz - :straight (plz :type git :host github :repo "alphapapa/plz.el")) +(use-package plz) (use-package ement - :straight (ement :type git :host github :repo "alphapapa/ement.el") :config (setq ement-room-images t ement-save-sessions t) @@ -2381,17 +2355,3 @@ interfere with the default `bongo-playlist-buffer'." gcmh-verbose nil)) (setq warning-suppress-types '((comp))) -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(safe-local-variable-values - '((projectile-project-run-cmd . "./build/bin/presenter") - (projectile-project-compilation-cmd . "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -B build/ . && make -j8 --dir build/ && rm -rf ~/.cache/librepresenter/LibrePresenter/qmlcache/")))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(org-modern-tag ((t :background "#9aedfe" :foreground "#282a36")))) diff --git a/recentf b/recentf index 278bb91b..c425da68 100644 --- a/recentf +++ b/recentf @@ -1,4 +1,4 @@ -;;; Automatically generated by ‘recentf’ on Fri Nov 11 09:46:17 2022. +;;; Automatically generated by ‘recentf’ on Tue Nov 15 14:06:57 2022. (setq recentf-list 'nil)