2024-05-19 23:38:49 +02:00
|
|
|
# Taken from: https://github.com/hlissner/dotfiles/blob/master/modules/editors/emacs.nix
|
2024-05-22 14:29:45 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2024-05-19 22:35:54 +02:00
|
|
|
cfg = config.modules.editors.emacs;
|
2024-05-20 01:17:59 +02:00
|
|
|
username = config.modules.other.system.username;
|
|
|
|
repoUrl = inputs.doomemacs;
|
|
|
|
configRepoUrl = inputs.doom-emacs-config;
|
2024-05-20 22:08:36 +02:00
|
|
|
emacs-desktop-symbol = pkgs.makeDesktopItem {
|
|
|
|
name = "emacsclient";
|
|
|
|
desktopName = "Emacs Client";
|
|
|
|
exec = "emacsclient -c -a emacs";
|
|
|
|
};
|
2024-05-19 22:35:54 +02:00
|
|
|
in {
|
|
|
|
options.modules.editors.emacs = {
|
2024-05-19 23:38:49 +02:00
|
|
|
enable = mkEnableOption "emacs";
|
|
|
|
doom.enable = mkEnableOption "doom";
|
2024-05-19 22:35:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-05-20 22:08:36 +02:00
|
|
|
## Emacs itself as an overlay
|
2024-05-22 14:29:45 +02:00
|
|
|
nixpkgs.overlays = [inputs.emacs-overlay.overlay];
|
2024-05-19 22:35:54 +02:00
|
|
|
|
2024-05-19 23:38:49 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
2024-05-19 22:35:54 +02:00
|
|
|
binutils # native-comp needs 'as', provided by this
|
|
|
|
# 28.2 + native-comp
|
|
|
|
((emacsPackagesFor emacsNativeComp).emacsWithPackages
|
2024-05-22 14:29:45 +02:00
|
|
|
(epkgs: [epkgs.vterm]))
|
2024-05-19 22:35:54 +02:00
|
|
|
|
2024-05-20 22:08:36 +02:00
|
|
|
emacs-desktop-symbol
|
2024-05-19 22:35:54 +02:00
|
|
|
## Doom dependencies
|
|
|
|
git
|
2024-05-22 14:29:45 +02:00
|
|
|
(ripgrep.override {withPCRE2 = true;})
|
2024-05-19 22:35:54 +02:00
|
|
|
gnutls # for TLS connectivity
|
|
|
|
|
|
|
|
## Optional dependencies
|
|
|
|
fd # faster projectile indexing
|
|
|
|
imagemagick # for image-dired
|
|
|
|
zstd # for undo-fu-session/undo-tree compression
|
|
|
|
|
|
|
|
## Module dependencies
|
|
|
|
# :checkers spell
|
2024-05-22 14:29:45 +02:00
|
|
|
(aspellWithDicts (ds: with ds; [en en-computers en-science]))
|
2024-05-19 22:35:54 +02:00
|
|
|
# :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
|
|
|
|
# :lang beancount
|
|
|
|
beancount
|
|
|
|
];
|
|
|
|
|
2024-05-22 14:29:45 +02:00
|
|
|
home-manager.users.${username}.home.sessionPath = ["/home/vali/.config/emacs/bin"];
|
2024-05-19 22:35:54 +02:00
|
|
|
|
2024-05-19 23:38:49 +02:00
|
|
|
# modules.shell.zsh.rcFiles = [ "${configDir}/emacs/aliases.zsh" ];
|
2024-05-19 22:35:54 +02:00
|
|
|
|
2024-05-22 14:29:45 +02:00
|
|
|
fonts.fonts = [pkgs.emacs-all-the-icons-fonts];
|
2024-05-19 22:35:54 +02:00
|
|
|
|
|
|
|
system.userActivationScripts = mkIf cfg.doom.enable {
|
|
|
|
installDoomEmacs = ''
|
2024-05-20 01:17:59 +02:00
|
|
|
#!/bin/bash
|
|
|
|
if [ ! -d "/home/${username}/.config/emacs" ]; then
|
|
|
|
git clone --depth=1 --single-branch "${repoUrl}" "/home/${username}/.config/emacs"
|
|
|
|
git clone "${configRepoUrl}" "/home/${username}/.config/doom"
|
2024-05-19 22:35:54 +02:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|