diff --git a/build-helpers/build-doom-profile.sh b/build-helpers/build-doom-profile.sh index d4cf9b2..288034a 100644 --- a/build-helpers/build-doom-profile.sh +++ b/build-helpers/build-doom-profile.sh @@ -45,7 +45,8 @@ if [[ -n "$profileName" ]]; then export HOME=$(mktemp -d) export DOOMPROFILE="$profileName"; fi -$runtimeShell $doomSource/bin/doomscript $buildProfile +$runtimeShell $doomSource/bin/doomscript $buildProfile \ + -l $deps/share/emacs/site-lisp # Similar to audit-tmpdir.sh in nixpkgs. if grep -q -F "$TMPDIR/" -r $out; then diff --git a/build-helpers/build-profile b/build-helpers/build-profile index f41d99a..58d83e1 100755 --- a/build-helpers/build-profile +++ b/build-helpers/build-profile @@ -18,6 +18,21 @@ ;; We skip Doom's normal install and initialization. (require 'straight) +;; Set from run! +(defvar site-lisp) + +(defun generate-nix-autoloads () + "Pull in autoloads for non-ELPA emacsWithPackages dependencies." + (let (filenames) + (dolist (filename (directory-files site-lisp)) + (when (string-suffix-p "-autoloads.el" filename) + (push (expand-file-name filename site-lisp) filenames))) + (doom-autoloads--scan filenames doom-autoloads-excluded-files 'literal))) + +(add-to-list + 'doom-profile-generators + '("80-loaddefs-nix.auto.el" . generate-nix-autoloads)) + ;; Doom runs this with package.el activated, but suppresses activation during ;; normal startup. Store the side effects of activation in the profile to avoid ;; (slow) package activation during normal startup. @@ -54,7 +69,8 @@ (add-to-list 'doom-autoloads-cached-vars 'package-activated-list) -(defcli! build-profile () +(defcli! build-profile + ((site-lisp ("-l" dir) "site-lisp directory to load autoloads from")) "Write a Doom profile." ;; Load our generated profile's init.el. Both to get the profile right and to ;; load the advice to make Doom not install straight. diff --git a/checks.nix b/checks.nix index 63cab0b..47877c8 100644 --- a/checks.nix +++ b/checks.nix @@ -81,6 +81,8 @@ in { interactive-without-loader = doomTest "no-profile" { config.default = true; } { profileName = ""; }; interactive-no-profile-hack = doomTest "no-profile" { config.default = true; } { noProfileHack = true; }; + cmake = doomTest "cmake" { lang.cc = true; } { }; + org-re-reveal = doomTest "org-re-reveal" { lang.org = [ "+present" ]; } { }; # Various tests of module combinations. diff --git a/default.nix b/default.nix index 168e048..54fed71 100644 --- a/default.nix +++ b/default.nix @@ -326,6 +326,7 @@ let buildProfile = ./build-helpers/build-profile; initEl = ./init.el; EMACS = lib.getExe emacsWithPackages; + inherit (emacsWithPackages) deps; # Enable this to troubleshoot failures at this step. #DEBUG = "1"; diff --git a/tests.el b/tests.el index 56120fb..c445eab 100644 --- a/tests.el +++ b/tests.el @@ -41,6 +41,11 @@ (unless (string-search "/site-lisp/revealjs" org-re-reveal-root) (error "org-re-reveal does not find our revealjs: %s" org-re-reveal-root))) +(defun test-cmake () + "Test cmake-mode autoloads are loaded." + (unless (functionp 'cmake-mode) + (error "cmake-mode not available"))) + (defun test-doom () (let* ((out (getenv "out")) (test (intern-soft (format "test-%s" (getenv "testName"))))