mirror of
https://github.com/nix-community/nix-doom-emacs
synced 2025-08-17 13:33:37 -05:00
Add doomPackageDir
argument.
This is a directory used for initializing the straight environment,
distinct from `doomPrivateDir`. If not given, `doomPrivateDir` is used.
Here it is in action:
be9f3a24c5/emacs/default.nix (L12-L34)
Fixes #297 (there are some ideas for extra sugar in that issue, but this
solves the core problem).
This commit is contained in:
24
default.nix
24
default.nix
@@ -1,5 +1,23 @@
|
||||
{ # The files would be going to ~/.config/doom (~/.doom.d)
|
||||
doomPrivateDir
|
||||
/* A Doom configuration directory from which to build the Emacs package environment.
|
||||
|
||||
Can be used, for instance, to prevent rebuilding the Emacs environment
|
||||
each time the `config.el` changes.
|
||||
|
||||
Can be provided as a directory or derivation. If not given, package
|
||||
environment is built against `doomPrivateDir`.
|
||||
|
||||
Example:
|
||||
doomPackageDir = pkgs.linkFarm "my-doom-packages" [
|
||||
# straight needs a (possibly empty) `config.el` file to build
|
||||
{ name = "config.el"; path = pkgs.emptyFile; }
|
||||
{ name = "init.el"; path = ./doom.d/init.el; }
|
||||
{ name = "packages.el"; path = pkgs.writeText "(package! inheritenv)"; }
|
||||
{ name = "modules"; path = ./my-doom-module; }
|
||||
];
|
||||
*/
|
||||
, doomPackageDir ? null
|
||||
/* Extra packages to install
|
||||
|
||||
Useful for non-emacs packages containing emacs bindings (e.g.
|
||||
@@ -105,6 +123,8 @@ let
|
||||
# Bundled version of `emacs-overlay`
|
||||
emacs-overlay = import (lock "emacs-overlay") pkgs pkgs;
|
||||
|
||||
doomPackageInstallDir = if doomPackageDir == null then doomPrivateDir else doomPackageDir;
|
||||
|
||||
# Stage 2: install dependencies and byte-compile prepared source
|
||||
doomLocal = let
|
||||
straight-env = pkgs.callPackage (lock "nix-straight") {
|
||||
@@ -126,7 +146,7 @@ let
|
||||
phases = [ "installPhase" ];
|
||||
nativeBuildInputs = [ git ];
|
||||
preInstall = ''
|
||||
export DOOMDIR=${doomPrivateDir}
|
||||
export DOOMDIR=${doomPackageInstallDir}
|
||||
export DOOMLOCALDIR=$(mktemp -d)/local/
|
||||
'';
|
||||
});
|
||||
@@ -144,7 +164,7 @@ let
|
||||
phases = [ "installPhase" ];
|
||||
nativeBuildInputs = [ git ];
|
||||
preInstall = ''
|
||||
export DOOMDIR=${doomPrivateDir}
|
||||
export DOOMDIR=${doomPackageInstallDir}
|
||||
export DOOMLOCALDIR=$out/
|
||||
|
||||
# Create a bogus $HOME directory because gccEmacs is known to require
|
||||
|
@@ -22,6 +22,27 @@ in
|
||||
'';
|
||||
apply = path: if lib.isStorePath path then path else builtins.path { inherit path; };
|
||||
};
|
||||
doomPackageDir = mkOption {
|
||||
description = ''
|
||||
A Doom configuration directory from which to build the Emacs package environment.
|
||||
|
||||
Can be used, for instance, to prevent rebuilding the Emacs environment
|
||||
each time the `config.el` changes.
|
||||
|
||||
Can be provided as a directory or derivation. If not given, package
|
||||
environment is built against `doomPrivateDir`.
|
||||
'';
|
||||
apply = path: if lib.isStorePath path then path else builtins.path { inherit path; };
|
||||
example = literalExample ''
|
||||
doomPackageDir = pkgs.linkFarm "my-doom-packages" [
|
||||
# straight needs a (possibly empty) `config.el` file to build
|
||||
{ name = "config.el"; path = pkgs.emptyFile; }
|
||||
{ name = "init.el"; path = ./doom.d/init.el; }
|
||||
{ name = "packages.el"; path = pkgs.writeText "(package! inheritenv)"; }
|
||||
{ name = "modules"; path = ./my-doom-module; }
|
||||
];
|
||||
'';
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
description = ''
|
||||
Extra configuration options to pass to doom-emacs.
|
||||
|
Reference in New Issue
Block a user