diff --git a/README.md b/README.md index 6f57025..86c6220 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,11 @@ in { This expression leverages [nix-straight.el](https://github.com/vlaci/nix-straight.el) under the hood for installing depdendencies. The restrictions of that package apply here too. + +## Usage + +instead of running emacs.d/bin/doom, once you have update your config files (packages.el, init.el, config.el), rebuild doom-emacs with nix. If you are using home-manager, simply run `home-manager switch` + +## Troubleshooting + +On macOS on a fresh install, you might run into the error `Too many files open`. running `ulimit -S -n 2048` will only work for the duration of your shell and will fix the error diff --git a/advice.el b/advice.el index 6be377b..675b0fc 100644 --- a/advice.el +++ b/advice.el @@ -1,13 +1,28 @@ ;;; -*- lexical-binding: t; -*- + +;;; Skip Emacs's own package verification and let Nix do it for us. +;;; +;;; Having gnupg around the build triggers Emacs to use it for package signature +;;; verification. This would not work anyway because the build sandbox does not +;;; 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) diff --git a/default.nix b/default.nix index bb6e1d7..4048a21 100644 --- a/default.nix +++ b/default.nix @@ -49,6 +49,7 @@ , runCommand , fetchFromGitHub , substituteAll +, writeShellScript , writeShellScriptBin , writeTextDir }: @@ -171,11 +172,25 @@ 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 = '' 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 @@ -184,6 +199,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 diff --git a/fix-paths.patch b/fix-paths.patch index 36ae118..385487b 100644 --- a/fix-paths.patch +++ b/fix-paths.patch @@ -1,8 +1,8 @@ diff --git a/core/autoload/config.el b/core/autoload/config.el -index 6bb9ae300..81ab62860 100644 +index 1e643cf49..501cbfba4 100644 --- a/core/autoload/config.el +++ b/core/autoload/config.el -@@ -20,7 +20,7 @@ +@@ -23,7 +23,7 @@ (defun doom/find-file-in-private-config () "Search for a file in `doom-private-dir' inside nixos-config." (interactive) @@ -10,4 +10,19 @@ index 6bb9ae300..81ab62860 100644 + (doom-project-find-file "@private@")) ;;;###autoload - (defun doom/reload () + (defun doom/goto-private-init-file () +diff --git a/modules/app/rss/config.el b/modules/app/rss/config.el +index c5657eec8..34f303420 100644 +--- a/modules/app/rss/config.el ++++ b/modules/app/rss/config.el +@@ -18,8 +18,8 @@ easier to scroll through.") + (use-package! elfeed + :commands elfeed + :init +- (setq elfeed-db-directory (concat doom-local-dir "elfeed/db/") +- elfeed-enclosure-default-dir (concat doom-local-dir "elfeed/enclosures/")) ++ (setq elfeed-db-directory (concat doom-cache-dir "elfeed/db/") ++ elfeed-enclosure-default-dir (concat doom-cache-dir "elfeed/enclosures/")) + :config + (setq elfeed-search-filter "@2-week-ago " + elfeed-show-entry-switch #'pop-to-buffer diff --git a/nix-integration.patch b/nix-integration.patch index c78136f..8faafd9 100644 --- a/nix-integration.patch +++ b/nix-integration.patch @@ -1,15 +1,12 @@ diff --git a/core/core.el b/core/core.el -index cb12f8d08..03f370691 100644 +index c8cfb0495..d8ed107bd 100644 --- a/core/core.el +++ b/core/core.el -@@ -63,22 +63,21 @@ decrease this. If you experience stuttering, increase this.") - "The root directory for Doom's modules. Must end with a slash.") - +@@ -92,20 +92,20 @@ envvar will enable this at startup.") (defconst doom-local-dir -- (if-let (localdir (getenv "DOOMLOCALDIR")) -- (expand-file-name (file-name-as-directory localdir)) + (if-let (localdir (getenv "DOOMLOCALDIR")) + (expand-file-name (file-name-as-directory localdir)) - (concat doom-emacs-dir ".local/")) -+ (or (getenv "DOOMLOCALDIR") + "@local@/") "Root directory for local storage. diff --git a/nix/sources.json b/nix/sources.json index 0d206a0..28ce642 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "", "owner": "hlissner", "repo": "doom-emacs", - "rev": "092480152e2ad9c70b60c4aa89d87af02da9f997", - "sha256": "0hpapk8ajmcx08npkp0gdzn0vfmlmp5wsy9sinnyhhbj2b0z48bw", + "rev": "ae3a2fa8c27d8e392294904ec6986f860a57f38e", + "sha256": "1f3vz9f10qqcxb9lwa51jkvg01v276gb1ssg2gc9jmny2m84d987", "type": "tarball", - "url": "https://github.com/hlissner/doom-emacs/archive/092480152e2ad9c70b60c4aa89d87af02da9f997.tar.gz", + "url": "https://github.com/hlissner/doom-emacs/archive/ae3a2fa8c27d8e392294904ec6986f860a57f38e.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "doom-snippets": { @@ -17,10 +17,10 @@ "homepage": "", "owner": "hlissner", "repo": "doom-snippets", - "rev": "60c57d66d2afd1798bff5023a54ab155f311746a", - "sha256": "1q8rzmkrgqdwmkdkcz9njbg3rmasrp19vwcqbqbbp6956i7mwyyq", + "rev": "94292e263b3351ddcd86dcb84acb19b8adaeab06", + "sha256": "0gx84ggg2226dwhqcsb8sk687ykbgp6sjxkryyh9jql01sjlb147", "type": "tarball", - "url": "https://github.com/hlissner/doom-snippets/archive/60c57d66d2afd1798bff5023a54ab155f311746a.tar.gz", + "url": "https://github.com/hlissner/doom-snippets/archive/94292e263b3351ddcd86dcb84acb19b8adaeab06.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "emacs-overlay": { @@ -29,10 +29,10 @@ "homepage": "", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "5d36f14d62da38e5f71c4dcc151ecbaa9feffbbc", - "sha256": "1nj5flxc9xwl9v9ay2d60z4gash37ppb1g66fwf9gmf54dyb3xhn", + "rev": "943ec43e54f5152c4d5d8d0076e72beea9a7ff5a", + "sha256": "1amckm9gnh8jr3f34m67im3fwjf5mm262m4sbar24j1f066dsgil", "type": "tarball", - "url": "https://github.com/nix-community/emacs-overlay/archive/5d36f14d62da38e5f71c4dcc151ecbaa9feffbbc.tar.gz", + "url": "https://github.com/nix-community/emacs-overlay/archive/943ec43e54f5152c4d5d8d0076e72beea9a7ff5a.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "emacs-so-long": { @@ -83,6 +83,18 @@ "url": "https://github.com/rgrinberg/evil-quick-diff/archive/69c883720b30a892c63bc89f49d4f0e8b8028908.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "explain-pause-mode": { + "branch": "master", + "description": "top, but for Emacs.", + "homepage": "", + "owner": "lastquestion", + "repo": "explain-pause-mode", + "rev": "2356c8c3639cbeeb9751744dbe737267849b4b51", + "sha256": "0frnfwqal9mrnrz6q4v7vcai26ahaw81894arff1yjw372pfgv7v", + "type": "tarball", + "url": "https://github.com/lastquestion/explain-pause-mode/archive/2356c8c3639cbeeb9751744dbe737267849b4b51.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "nix-straight.el": { "branch": "v2.1.0", "description": null, @@ -95,6 +107,18 @@ "url": "https://github.com/vlaci/nix-straight.el/archive/9e6f7d71760b997b09d9bd3046257bc9ec17265b.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "nose": { + "branch": "master", + "description": null, + "homepage": null, + "owner": "emacsattic", + "repo": "nose", + "rev": "f8528297519eba911696c4e68fa88892de9a7b72", + "sha256": "07bhzddaxdjd591xmg59yd657a1is0q515291jd83mjsmgq258bm", + "type": "tarball", + "url": "https://github.com/emacsattic/nose/archive/f8528297519eba911696c4e68fa88892de9a7b72.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "ob-racket": { "branch": "master", "description": "Org babel support for racket", @@ -113,10 +137,10 @@ "homepage": "https://code.orgmode.org/bzg/org-mode", "owner": "emacs-straight", "repo": "org-mode", - "rev": "a1e5bee5cb9c34ceb8226597605a49638bee7cec", - "sha256": "17dysdgkwv1hgi95zv5rrkxn21rbp5jyb8w2grgh93nmw7psmlwf", + "rev": "7bc18ebbed409ace4665ec9c9910b2837834b03d", + "sha256": "1jn9jfliymvh8s7szzsybkhm4z3g7bw2zvc15k5waskn4zw07pph", "type": "tarball", - "url": "https://github.com/emacs-straight/org-mode/archive/a1e5bee5cb9c34ceb8226597605a49638bee7cec.tar.gz", + "url": "https://github.com/emacs-straight/org-mode/archive/7bc18ebbed409ace4665ec9c9910b2837834b03d.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "org-yt": { @@ -143,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 d534251..e59f414 100644 --- a/overrides.nix +++ b/overrides.nix @@ -19,6 +19,10 @@ self: super: { ''; }; + explain-pause-mode = self.straightBuild { + pname = "explain-pause-mode"; + }; + evil-markdown = self.straightBuild { pname = "evil-markdown"; }; @@ -38,6 +42,10 @@ self: super: { ''; }); + nose = self.straightBuild { + pname = "nose"; + }; + org-mode = self.straightBuild rec { pname = "org-mode"; version = "9.4"; @@ -63,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";