diff --git a/advice.el b/advice.el index e5f8255..3f97c50 100644 --- a/advice.el +++ b/advice.el @@ -14,3 +14,7 @@ :override (lambda (q) (message "%s \n[nix-doom-emacs] --> answering NO" q) nil)) + +;;; org is not installed from git, so no fixup is needed +(advice-add '+org-fix-package-h + :override (lambda (&rest r))) diff --git a/default.nix b/default.nix index c53ec2e..ff69eb7 100644 --- a/default.nix +++ b/default.nix @@ -1,12 +1,31 @@ { # The files would be going to ~/.config/doom (~/.doom.d) doomPrivateDir + /* Extra packages to install + + Useful for non-emacs packages containing emacs bindings (e.g. + mu4e). + + Example: + extraPackages = epkgs: [ pkgs.mu ]; + */ +, extraPackages ? epkgs: [] + /* Extra configuration to source during initialization + + Use this to refer other nix derivations. + + Example: + extraConfig = '' + (setq mu4e-mu-binary = "${pkgs.mu}/bin/mu") + ''; + */ +, extraConfig ? "" /* Package set to install emacs and dependent packages from - Only used to get emacs package, if `bundledPackages` is set + Only used to get emacs package, if `bundledPackages` is set. */ , emacsPackages /* Use bundled revision of github.com/nix-community/emacs-overlay - as `emacsPackages` + as `emacsPackages`. */ , bundledPackages ? true /* Override dependency versions @@ -45,6 +64,14 @@ let evil-escape = super.evil-escape.overrideAttrs (esuper: { patches = [ ./evil-escape.patch ]; }); + evil-markdown = self.trivialBuild rec { + pname = "evil-markdown"; + version = "1"; + recipe = null; + ename = pname; + src = lock.get pname; + buildPhase = ":"; + }; org-yt = self.trivialBuild rec { pname = "org-yt"; version = "1"; @@ -52,6 +79,21 @@ let ename = pname; src = lock.get pname; }; + php-extras = self.trivialBuild rec { + pname = "php-extras"; + version = "1"; + recipe = null; + ename = pname; + src = lock.get pname; + buildPhase = ":"; + }; + so-long = self.trivialBuild rec { + pname = "so-long"; + version = "1"; + recipe = null; + ename = "emacs-so-long"; + src = lock.get pname; + }; }; # Stage 1: prepare source for byte-compilation @@ -61,7 +103,7 @@ let phases = ["unpackPhase" "patchPhase" "installPhase"]; patches = [ (substituteAll { - src = ./fix-paths-pre.patch; + src = ./fix-paths.patch; private = builtins.toString doomPrivateDir; }) ]; @@ -74,7 +116,7 @@ let # Bundled version of `emacs-overlay` emacs-overlay = import (lock.get "emacs-overlay") pkgs pkgs; - # Stage 2:: install dependencies and byte-compile prepared source + # Stage 2: install dependencies and byte-compile prepared source doomLocal = let straight-env = pkgs.callPackage (lock.get "nix-straight.el") { @@ -85,6 +127,7 @@ let in epkgs.overrideScope' overrides else emacsPackages.overrideScope' overrides; + emacs = emacsPackages.emacsWithPackages extraPackages; emacsLoadFiles = [ ./advice.el ]; emacsArgs = [ "--" @@ -131,7 +174,7 @@ let src = doomSrc; patches = [ (substituteAll { - src = ./fix-paths.patch; + src = ./nix-integration.patch; local = doomLocal; }) ]; @@ -144,14 +187,23 @@ let # Stage 4: catch-all wrapper capable to run doom-emacs even # without installing ~/.emacs.d - emacs = (emacsPackages.emacsWithPackages (epkgs: [ - (writeTextDir "share/emacs/site-lisp/default.el" '' - (message "doom-emacs is not placed in `doom-private-dir', - loading from `site-lisp'") - (when (> emacs-major-version 26) - (load "${doom-emacs}/early-init.el")) - (load "${doom-emacs}/init.el") - '') + emacs = let + load-config-from-site = writeTextDir "share/emacs/site-lisp/default.el" '' + (message "doom-emacs is not placed in `doom-private-dir', + loading from `site-lisp'") + (when (> emacs-major-version 26) + (load "${doom-emacs}/early-init.el")) + (load "${doom-emacs}/init.el") + ''; + + load-extra-config = writeTextDir "share/emacs/site-lisp/nix-integration.el" '' + ;;; -*- lexical-binding: t; -*- + + ${extraConfig} + ''; + in (emacsPackages.emacsWithPackages (epkgs: [ + load-extra-config + load-config-from-site ])).overrideAttrs (super: { outputs = [ "out" "emacsd" ]; buildInputs = [ doom-emacs ]; diff --git a/derivations.json b/derivations.json index af276f9..a075c5a 100644 --- a/derivations.json +++ b/derivations.json @@ -7,12 +7,24 @@ "nix-straight.el": { "owner": "vlaci", "repo": "nix-straight.el", - "rev": "v1.0" + "rev": "v1.1.0" + }, + "evil-markdown": { + "owner": "Somelauw", + "repo": "evil-markdown" }, "org-yt": { "owner": "TobiasZawada", "repo": "org-yt" }, + "php-extras": { + "owner": "arnested", + "repo": "php-extras" + }, + "so-long": { + "owner": "hlissner", + "repo": "emacs-so-long" + }, "emacs-overlay": { "owner": "nix-community", "repo": "emacs-overlay" diff --git a/derivations.lock b/derivations.lock index 83ee68b..cf7ef4e 100644 --- a/derivations.lock +++ b/derivations.lock @@ -4,12 +4,12 @@ "args": { "owner": "hlissner", "repo": "doom-emacs", - "rev": "58e674d8fb85515e7980c87fc708dabb2b276128", - "sha256": "1algblcah2y5lbrn60fjslszx3jz1p9w7bh82c788ih1d8x7z253" + "rev": "5ece51a2a6d66f551ae8a9bf1233afe85e6a37c4", + "sha256": "0xf7kjipql47r4n69rvzwqkp0h42hwpza1qw5mc2mm63zkd7xm8w" }, "meta": { - "updated": "2019-11-10T14:33:52+00:00", - "rev": "58e674d8fb85515e7980c87fc708dabb2b276128" + "updated": "2019-11-23T09:46:57+00:00", + "rev": "5ece51a2a6d66f551ae8a9bf1233afe85e6a37c4" } }, "nix-straight.el": { @@ -17,12 +17,12 @@ "args": { "owner": "vlaci", "repo": "nix-straight.el", - "rev": "6182914aefea06ef514cd3f3f7f9f67db45940db", - "sha256": "038dss49bfvpj15psh5pr9jyavivninl0rzga9cn8qyc4g2cj5i0" + "rev": "ed6b14fc7a4f391229e74d5a8828a351798dda27", + "sha256": "0rmpvz2c2f4vdk8xdk0xqdr3pzxqfimwch4ri7cyyzqc327bd0m8" }, "meta": { - "updated": "2019-10-25T22:28:25+00:00", - "rev": "6182914aefea06ef514cd3f3f7f9f67db45940db" + "updated": "2019-11-22T19:53:27+00:00", + "rev": "ed6b14fc7a4f391229e74d5a8828a351798dda27" } }, "org-yt": { @@ -43,12 +43,51 @@ "args": { "owner": "nix-community", "repo": "emacs-overlay", - "rev": "0bd32c063118ddc95d1a73ccd01b51a2d6dda24e", - "sha256": "1yc1az5l6073x1amk4g3rvfd98wsq3z3jvh2l7crp8q6wq9rndpa" + "rev": "772fed0a34ca331df095ba1dd783fad34b88e237", + "sha256": "0qj7jd7sl6wqwflicw8zjjrp1vj6xwbid7h1slr24zkima0cgxhs" }, "meta": { - "updated": "2019-11-10T14:33:57+00:00", - "rev": "0bd32c063118ddc95d1a73ccd01b51a2d6dda24e" + "updated": "2019-11-23T13:59:16+00:00", + "rev": "772fed0a34ca331df095ba1dd783fad34b88e237" + } + }, + "evil-markdown": { + "fetcher": "fetchFromGitHub", + "args": { + "owner": "Somelauw", + "repo": "evil-markdown", + "rev": "46cd81b37991c4325fc24015a610f832b0ff995d", + "sha256": "0mad8sp5y9vyk28595qygspnyh8bfmb1fbxjlw70qwc1kdn822n4" + }, + "meta": { + "updated": "2019-11-23T14:33:01+00:00", + "rev": "46cd81b37991c4325fc24015a610f832b0ff995d" + } + }, + "php-extras": { + "fetcher": "fetchFromGitHub", + "args": { + "owner": "arnested", + "repo": "php-extras", + "rev": "81ebd7c1a8c8d02b2775d4cdbf73653feb608a7c", + "sha256": "181dg1z00qagwb9qd45fpcrya32mdgj8dnkpnfv52lqmi94vvzg0" + }, + "meta": { + "updated": "2019-11-23T14:33:03+00:00", + "rev": "81ebd7c1a8c8d02b2775d4cdbf73653feb608a7c" + } + }, + "so-long": { + "fetcher": "fetchFromGitHub", + "args": { + "owner": "hlissner", + "repo": "emacs-so-long", + "rev": "cfae473b1bf65f78ddb015159e667ec0103d881c", + "sha256": "0g943n5cl9lz5s7hszg6yvp10xd1xvd8mfgxyg0yckmp8fqkswin" + }, + "meta": { + "updated": "2019-11-23T14:32:59+00:00", + "rev": "cfae473b1bf65f78ddb015159e667ec0103d881c" } } } diff --git a/fix-paths-pre.patch b/fix-paths-pre.patch deleted file mode 100644 index 36ae118..0000000 --- a/fix-paths-pre.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/core/autoload/config.el b/core/autoload/config.el -index 6bb9ae300..81ab62860 100644 ---- a/core/autoload/config.el -+++ b/core/autoload/config.el -@@ -20,7 +20,7 @@ - (defun doom/find-file-in-private-config () - "Search for a file in `doom-private-dir' inside nixos-config." - (interactive) -- (doom-project-find-file doom-private-dir)) -+ (doom-project-find-file "@private@")) - - ;;;###autoload - (defun doom/reload () diff --git a/fix-paths.patch b/fix-paths.patch index 145699f..36ae118 100644 --- a/fix-paths.patch +++ b/fix-paths.patch @@ -1,40 +1,13 @@ -diff --git a/core/core.el b/core/core.el -index cb12f8d08..03f370691 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.") +diff --git a/core/autoload/config.el b/core/autoload/config.el +index 6bb9ae300..81ab62860 100644 +--- a/core/autoload/config.el ++++ b/core/autoload/config.el +@@ -20,7 +20,7 @@ + (defun doom/find-file-in-private-config () + "Search for a file in `doom-private-dir' inside nixos-config." + (interactive) +- (doom-project-find-file doom-private-dir)) ++ (doom-project-find-file "@private@")) - (defconst doom-local-dir -- (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. - - Use this as a storage location for this system's installation of Doom Emacs. - These files should not be shared across systems. By default, it is used by - `doom-etc-dir' and `doom-cache-dir'. Must end with a slash.") - --(defconst doom-etc-dir (concat doom-local-dir "etc/") -+(defconst doom-etc-dir "~/.local/doom" - "Directory for non-volatile local storage. - - Use this for files that don't change much, like server binaries, external - dependencies or long-term shared data. Must end with a slash.") - --(defconst doom-cache-dir (concat doom-local-dir "cache/") -+(defconst doom-cache-dir "~/.cache/doom/" - "Directory for volatile local storage. - - Use this for files that change often, like cache files. Must end with a slash.") -@@ -196,7 +195,7 @@ users).") - (setq abbrev-file-name (concat doom-local-dir "abbrev.el") - async-byte-compile-log-file (concat doom-etc-dir "async-bytecomp.log") - bookmark-default-file (concat doom-etc-dir "bookmarks") -- custom-file (concat doom-private-dir "init.el") -+ custom-file (concat doom-etc-dir "init.el") - custom-theme-directory (concat doom-private-dir "themes/") - desktop-dirname (concat doom-etc-dir "desktop") - desktop-base-file-name "autosave" + ;;;###autoload + (defun doom/reload () diff --git a/nix-integration.patch b/nix-integration.patch new file mode 100644 index 0000000..0645fe9 --- /dev/null +++ b/nix-integration.patch @@ -0,0 +1,48 @@ +diff --git a/core/core.el b/core/core.el +index cb12f8d08..03f370691 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.") + + (defconst doom-local-dir +- (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. + + Use this as a storage location for this system's installation of Doom Emacs. + These files should not be shared across systems. By default, it is used by + `doom-etc-dir' and `doom-cache-dir'. Must end with a slash.") + +-(defconst doom-etc-dir (concat doom-local-dir "etc/") ++(defconst doom-etc-dir "~/.local/doom" + "Directory for non-volatile local storage. + + Use this for files that don't change much, like server binaries, external + dependencies or long-term shared data. Must end with a slash.") + +-(defconst doom-cache-dir (concat doom-local-dir "cache/") ++(defconst doom-cache-dir "~/.cache/doom/" + "Directory for volatile local storage. + + Use this for files that change often, like cache files. Must end with a slash.") +@@ -196,7 +195,7 @@ users).") + (setq abbrev-file-name (concat doom-local-dir "abbrev.el") + async-byte-compile-log-file (concat doom-etc-dir "async-bytecomp.log") + bookmark-default-file (concat doom-etc-dir "bookmarks") +- custom-file (concat doom-private-dir "init.el") ++ custom-file (concat doom-etc-dir "init.el") + custom-theme-directory (concat doom-private-dir "themes/") + desktop-dirname (concat doom-etc-dir "desktop") + desktop-base-file-name "autosave" +@@ -489,6 +488,7 @@ to least)." + (daemonp)) + (file-exists-p doom-env-file)) + (doom-load-envvars-file doom-env-file)) ++ (load "nix-integration.el" t) + + (require 'core-modules) + (let (;; `doom-autoload-file' tells Emacs where to load all its functions