mirror of
https://github.com/nix-community/nix-doom-emacs
synced 2025-08-27 14:23:45 -05:00
Merge pull request #1 from rossabaker/master
Make work on nixpkgs-unstable, as programs.emacs.package
This commit is contained in:
52
default.nix
52
default.nix
@@ -190,18 +190,7 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
# Stage 4: catch-all wrapper capable to run doom-emacs even
|
||||
# without installing ~/.emacs.d
|
||||
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")
|
||||
'';
|
||||
|
||||
# `extraConfig` is merged into private configuration
|
||||
# Stage 4: `extraConfig` is merged into private configuration
|
||||
doomDir = pkgs.runCommand "doom-private" {
|
||||
inherit extraConfig;
|
||||
passAsFile = [ "extraConfig" ];
|
||||
@@ -211,17 +200,34 @@ let
|
||||
chmod u+w $out/config.el
|
||||
cat $extraConfigPath >> $out/config.el
|
||||
'';
|
||||
|
||||
# Stage 5: catch-all wrapper capable to run doom-emacs even
|
||||
# without installing ~/.emacs.d
|
||||
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")
|
||||
'';
|
||||
in (emacsPackages.emacsWithPackages (epkgs: [
|
||||
load-config-from-site
|
||||
])).overrideAttrs (super: {
|
||||
outputs = [ "out" "emacsd" ];
|
||||
buildInputs = [ doom-emacs ];
|
||||
installPhase = super.installPhase + ''
|
||||
ln -snf ${doom-emacs} $emacsd
|
||||
for prog in $out/bin/*; do
|
||||
wrapProgram $prog --set DOOMDIR ${doomDir}
|
||||
]));
|
||||
in
|
||||
pkgs.runCommand "doom-emacs" {
|
||||
inherit emacs;
|
||||
buildInputs = [ emacs ];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
for prog in $emacs/bin/*; do
|
||||
makeWrapper $prog $out/bin/$(basename $prog) --set DOOMDIR ${doomDir}
|
||||
done
|
||||
'';
|
||||
});
|
||||
|
||||
in emacs
|
||||
# emacsWithPackages assumes share/emacs/site-lisp/subdirs.el
|
||||
# exists, but doesn't pass it along. When home-manager calls
|
||||
# emacsWithPackages again on this derivation, it fails due to
|
||||
# a dangling link to subdirs.el.
|
||||
# https://github.com/NixOS/nixpkgs/issues/66706
|
||||
ln -s ${emacs.emacs}/share $out
|
||||
''
|
||||
|
Reference in New Issue
Block a user