Writing profiles.el was borderline unreadable. `doom-profiles-autodetect` was effectively just reading in the entire file: accepting the paths we want in the profile as individual args and putting them together on the Emacs side is easy enough. Accidentally fixes a bug: `user-emacs-directory` should end in a directory separator. We now get the right value for free by using the path we're running Doom CLI out of.
35 lines
1.3 KiB
EmacsLisp
35 lines
1.3 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
|
|
((profile-name ("-n" form) "Profile name.")
|
|
(profile-directory ("-p" dir) "Profile data directory.")
|
|
(profile-doom-dir ("-d" dir) "DOOMDIR"))
|
|
"Write Doom's profile loader."
|
|
(let ((new-profiles `((,profile-name
|
|
(user-emacs-directory . ,doom-emacs-dir)
|
|
(doom-profile-data-dir . ,profile-directory)
|
|
("DOOMDIR" . ,profile-doom-dir)))))
|
|
(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))
|