New option to specify additional configuration
This enables emacs configuration to refer nix store paths.
This commit is contained in:
39
default.nix
39
default.nix
@ -9,6 +9,16 @@
|
||||
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.
|
||||
@ -70,7 +80,7 @@ let
|
||||
phases = ["unpackPhase" "patchPhase" "installPhase"];
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./fix-paths-pre.patch;
|
||||
src = ./fix-paths.patch;
|
||||
private = builtins.toString doomPrivateDir;
|
||||
})
|
||||
];
|
||||
@ -141,7 +151,7 @@ let
|
||||
src = doomSrc;
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./fix-paths.patch;
|
||||
src = ./nix-integration.patch;
|
||||
local = doomLocal;
|
||||
})
|
||||
];
|
||||
@ -154,14 +164,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 ];
|
||||
|
@ -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 ()
|
@ -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 ()
|
||||
|
48
nix-integration.patch
Normal file
48
nix-integration.patch
Normal file
@ -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
|
Reference in New Issue
Block a user