[emacs] Use external module for doom config

This commit is contained in:
2024-12-16 11:03:16 -08:00
parent 98ef9b1443
commit 1ce431b0e5
3 changed files with 208 additions and 52 deletions

View File

@@ -2,14 +2,7 @@
with lib;
let
doomSync = (let
git = pkgs.git;
in ''
export PATH=${pkgs.emacs}/bin:${git}/bin:$PATH
${config.xdg.configHome}/emacs/bin/doom sync -u -j $((`nproc`/4*3))
'');
in {
{
config = {
home.packages = [
pkgs.emacs-all-the-icons-fonts
@@ -26,43 +19,15 @@ in {
pkgs.python3
];
programs.doom-emacs = {
enable = true;
doomDir = ./doom;
};
fonts.fontconfig.enable = true;
home.file = {
".config/emacs" = {
source = fetchGit {
url = "https://github.com/doomemacs/doomemacs.git";
# When updating me, remember to run `doom sync`
rev = "f425f2ff3da584cfe2676f6b9cf1d81a690a75e5";
};
# We need to use recursive mode here or else doom fails to sync for
# some reason related to the permissions on the synced path. I'm not
# quite sure of everything that's going on here.
recursive = true;
# Because `recursive = true` will cause this to sync every single
# activation, we turn this off here.
#
# There's probably a way we could do better detection of this within
# our onChange shell?
#
# onChange = doomSync;
};
};
home.sessionVariables = {
DOOMLOCALDIR = "${config.xdg.dataHome}/doom";
EDITOR = "emacs -nw";
};
home.sessionPath = [
"${config.xdg.configHome}/emacs/bin"
];
xdg.configFile."doom" = {
source = ./doom;
# Sync doom if we updated the config
onChange = doomSync;
};
};
}