66 lines
2.2 KiB
Nix
66 lines
2.2 KiB
Nix
{ config, lib, pkgs, inputs, ... }:
|
|
with lib;
|
|
with lib.custom;
|
|
let
|
|
cfg = config.modules.editors.emacs;
|
|
configDir = config.dotfiles.configDir;
|
|
in {
|
|
options.modules.editors.emacs = {
|
|
enable = mkBoolOpt false;
|
|
doom = rec {
|
|
enable = mkBoolOpt false;
|
|
repoUrl = mkOpt types.str "https://github.com/doomemacs/doomemacs";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
nixpkgs.overlays = [ inputs.emacs-overlay.overlay ];
|
|
|
|
user.packages = with pkgs; [
|
|
## Emacs itself
|
|
binutils # native-comp needs 'as', provided by this
|
|
# 28.2 + native-comp
|
|
((emacsPackagesFor emacs-unstable).emacsWithPackages (epkgs: [ epkgs.vterm ]))
|
|
|
|
## Doom dependencies
|
|
git
|
|
(ripgrep.override {withPCRE2 = true;})
|
|
gnutls # for TLS connectivity
|
|
|
|
## Optional dependencies
|
|
fd # faster projectile indexing
|
|
imagemagick # for image-dired
|
|
(mkIf (config.programs.gnupg.agent.enable) pinentry_emacs) # in-emacs gnupg prompts
|
|
zstd # for undo-fu-session/undo-tree compression
|
|
|
|
## Module dependencies
|
|
# :checkers spell
|
|
(aspellWithDicts (ds: with ds; [ en en-computers en-science ]))
|
|
# :tools editorconfig
|
|
editorconfig-core-c # per-project style config
|
|
# :tools lookup & :lang org +roam
|
|
sqlite
|
|
# :lang latex & :lang org (latex previews)
|
|
texlive.combined.scheme-medium
|
|
];
|
|
|
|
env.PATH = [ "$XDG_CONFIG_HOME/emacs/bin" ];
|
|
|
|
modules.shell.zsh.rcFiles = [ "${configDir}/emacs/aliases.zsh" ];
|
|
|
|
fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
|
|
|
|
system.userActivationScripts = mkIf cfg.doom.enable {
|
|
installDoomEmacs = ''
|
|
if [ ! -d "$XDG_CONFIG_HOME/emacs" ]; then
|
|
git clone --depth=1 --single-branch "${cfg.doom.repoUrl}" "$XDG_CONFIG_HOME/emacs"
|
|
fi
|
|
'';
|
|
};
|
|
|
|
home.configFile = {
|
|
"doom" = { source = "${configDir}/emacs/doom"; recursive = true; };
|
|
};
|
|
};
|
|
}
|