nix-doom-emacs-unstraightened/cli2.el
Marien Zwart c1a9df33d4
Use Doom profile loader to load our profile
This seems like a relatively sane way of loading our profile from the
Nix store. The alternatives I see are patching Doom (which I'm trying to
avoid) or setting DOOMLOCALDIR. If we set DOOMLOCALDIR, Doom sets enough
variables based on it it would be a pain to clean them up after we gain
control.

Using the profile loader lets us set doom-profile-data-dir early, which
currently only contains the profile and env file.
2024-03-29 22:54:58 +11:00

29 lines
1 KiB
EmacsLisp

;;; cli.el -*- lexical-binding: t; -*-
;; We skip Doom's normal install and initialization.
(require 'straight)
(defadvice! nix-doom-skip-core-packages (orig-fn &rest args)
"HACK: don't install straight and core packages.
`doom-initialize-core-packages' would no-op out if
`straight-recipe-repositories' is set, but we do not want to set
it. Just skip it entirely."
:override #'doom-initialize-core-packages
t)
(defcli! build-profile-loader-for-nix-build ()
"Write Doom's profile loader."
(let ((new-profiles (doom-profiles-autodetect)))
(doom-profiles-save new-profiles)))
(defcli! build-profile-for-nix-build ()
"Write a Doom profile."
;; HACK: this initializes enough of straight (particularly
;; straight--build-cache, which doom-profile--generate-package-autoloads hits)
;; to make Doom work.
;;
;; TODO: remove doom-profile--generate-package-autoloads?
;; Because there are no straight-built packages, it generates an empty file.
(straight-prune-build-cache)
(doom-profile-generate))