From 64928132dd0fc203753104cbf8e8be9d9d191da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Fri, 21 Aug 2020 12:23:31 +0200 Subject: [PATCH 1/4] nix-doom-emacs: add a summary at the end of build It makes debugging so much easier --- default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/default.nix b/default.nix index bb6e1d7..4b2fc82 100644 --- a/default.nix +++ b/default.nix @@ -49,6 +49,7 @@ , runCommand , fetchFromGitHub , substituteAll +, writeShellScript , writeShellScriptBin , writeTextDir }: @@ -171,6 +172,17 @@ let in (emacsPackages.emacsWithPackages (epkgs: [ load-config-from-site ])); + + build-summary = writeShellScript "build-summary" '' + BOLD=\\033[1m + GREEN=\\033[32m + RESET=\\033[0m + + printf "\n''${GREEN}Successfully built nix-doom-emacs!''${RESET}\n" + printf "''${BOLD} ==> doom-emacs is installed to ${doom-emacs}''${RESET}\n" + printf "''${BOLD} ==> private configuration is installed to ${doomDir}''${RESET}\n" + printf "''${BOLD} ==> Dependencies are installed to ${doomLocal}''${RESET}\n" + ''; in emacs.overrideAttrs (esuper: let cmd = '' @@ -184,6 +196,7 @@ emacs.overrideAttrs (esuper: # https://github.com/NixOS/nixpkgs/issues/66706 rm -rf $out/share ln -s ${esuper.emacs}/share $out + ${build-summary} ''; in if esuper ? buildCommand then From 546c7a84b76e31a8454435006d34bab3d920982d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Fri, 21 Aug 2020 15:47:18 +0200 Subject: [PATCH 2/4] nix-doom-emacs: add env variables to aid debugging --- default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 4b2fc82..4048a21 100644 --- a/default.nix +++ b/default.nix @@ -187,7 +187,10 @@ in emacs.overrideAttrs (esuper: let cmd = '' for prog in $out/bin/*; do - wrapProgram $out/bin/$(basename $prog) --set DOOMDIR ${doomDir} + wrapProgram $out/bin/$(basename $prog) \ + --set DOOMDIR ${doomDir} \ + --set __DEBUG_doom_emacs_DIR ${doom-emacs} \ + --set __DEBUG_doomLocal_DIR ${doomLocal} done # emacsWithPackages assumes share/emacs/site-lisp/subdirs.el # exists, but doesn't pass it along. When home-manager calls From 314de52ee480236b21fdab3f576ad1316ed9dee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Sun, 30 Aug 2020 18:46:19 +0200 Subject: [PATCH 3/4] Prevent doom to kill emacs before dumping package list New behavior is introduced here: > commit e632871a115528a9c1ce90d7d2147873009716eb > Author: Henrik Lissner > Date: Mon Aug 24 00:36:52 2020 -0400 > > core-cli: backport more refactors from rewrite > > Still a long way to go, but this introduces a few niceties for > debugging CLI failures: > > + The (extended) output of the last bin/doom command is now logged to > ~/.emacs.d/.local/doom.log > + If an error occurs, short backtraces are displayed whether or not you > have debug mode on. The full backtrace is written to > ~/.emacs.d/.local/doom.error.log. > + bin/doom now aborts with a warning if: > - The script itself or its parent directory is a symlink. It's fine if > ~/.emacs.d is symlinked though. > - Running bin/doom as root when your DOOMDIR isn't in /root/. > - If you're sporting Emacs 26.1 (now handled in the elisp side rather > than the /bin/sh shebang preamble). > + If a 'doom sync' was aborted prematurely, you'll be warned that Doom > was left in an inconsistent state and that you must run `doom sync` > again. > > May address #3746 The above commit introduces an explicit call to `(kill-emacs)` at the end of doom cli's main function. This conflicts with `nix-straight.el`'s package collection as it would run after doom is initialized. The commit disables `(kill-emacs)` method while package collection is in progress. --- advice.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/advice.el b/advice.el index 82f2d96..675b0fc 100644 --- a/advice.el +++ b/advice.el @@ -7,15 +7,22 @@ ;;; have a properly configured user home and environment. (setq package-check-signature nil) +(defun nix-straight-inhibit-kill-emacs (arg) + (message "[nix-doom-emacs] Inhibiting (kill-emacs)")) + (advice-add 'nix-straight-get-used-packages - :before (lambda (&rest r) + :around (lambda (orig-fn &rest r) (message "[nix-doom-emacs] Advising doom installer to gather packages to install...") (advice-add 'doom-autoloads-reload :override (lambda (&optional file force-p) (message "[nix-doom-emacs] Skipping generating autoloads..."))) (advice-add 'doom--print :override (lambda (output) - (message output))))) + (message output))) + (advice-add 'kill-emacs + :override #'nix-straight-inhibit-kill-emacs) + (apply orig-fn r) + (advice-remove 'kill-emacs 'nix-straight-inhibit-kill-emacs))) (advice-add 'y-or-n-p :override (lambda (q) From f1aa5a9ca7939b9a44bea720e264cf0b672e57ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Sun, 30 Aug 2020 19:10:08 +0200 Subject: [PATCH 4/4] Fix `(org +present)` by downloading `reveal.js` See the following commit in doom-emacs: > commit 723583e8d737fac93a05fe9dc06a233f3efdc305 > Author: Diego Zamboni > Date: Thu Aug 27 07:15:14 2020 +0200 > > Automatically download reveal.js and use local copy, default to v4 (#3846) > > * Automatically download reveal.js upgrade to v4 > > The +present option now automatically checks out the reveal.js > repository and configures org-re-reveal to use it. It also now uses > reveal.js 4 instead of 3.9.2. > > * Changed :init to :config --- nix/sources.json | 12 ++++++++++++ overrides.nix | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/nix/sources.json b/nix/sources.json index 472081c..e2c7835 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -167,6 +167,18 @@ "url": "https://github.com/arnested/php-extras/archive/d410c5af663c30c01d461ac476d1cbfbacb49367.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "reveal.js": { + "branch": "master", + "description": "The HTML Presentation Framework", + "homepage": "https://revealjs.com", + "owner": "hakimel", + "repo": "reveal.js", + "rev": "15815efe05ca69c35ce66cfdbf93316e1db66ecb", + "sha256": "1g3h710rhpyq4vnh6rgyay2dyjpw4rw99p062yhwhgrjkgjyzrc2", + "type": "tarball", + "url": "https://github.com/hakimel/reveal.js/archive/15815efe05ca69c35ce66cfdbf93316e1db66ecb.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "rotate-text.el": { "branch": "master", "description": "Emacs: cycle through words, symbols and patterns", diff --git a/overrides.nix b/overrides.nix index ccae250..e59f414 100644 --- a/overrides.nix +++ b/overrides.nix @@ -71,6 +71,18 @@ self: super: { pname = "php-extras"; }; + revealjs = self.straightBuild { + pname = "reveal.js"; + ename = "revealjs"; + + installPhase = '' + LISPDIR=$out/share/emacs/site-lisp + install -d $LISPDIR + + cp -r * $LISPDIR + ''; + }; + rotate-text = self.straightBuild { pname = "rotate-text.el"; ename = "rotate-text";