Files
bankrupt/home-manager/modules/doom-emacs.nix
T
2026-01-23 01:26:09 +08:00

79 lines
2.4 KiB
Nix

# Doom Emacs configuration via nix-doom-emacs-unstraightened
# https://github.com/marienz/nix-doom-emacs-unstraightened
{
config,
lib,
pkgs,
...
}: let
cfg = config.programs.doom-emacs;
in {
# The actual doom-emacs module is imported via the flake's homeModule
# This file just configures it with our local doom.d directory
programs.doom-emacs = {
enable = true;
# Path to our Doom configuration directory
# Must be in the Nix store (a path literal, not a string)
doomDir = ../../doom.d;
# Where Doom stores local state (cache, etc.)
# Must be an absolute path
doomLocalDir = "${config.home.homeDirectory}/.local/share/nix-doom";
# Use emacs30-pgtk for Wayland support on Linux
# On macOS, use emacs30 from emacs-overlay (native-comp, tree-sitter)
# fix-window-role.patch applied via overlay for yabai compatibility
emacs =
if pkgs.stdenv.isLinux
then pkgs.emacs30-pgtk
else pkgs.emacs30;
# Extra packages to make available (tree-sitter grammars, etc.)
# Tree-sitter grammars are not installed automatically by Doom
extraPackages = epkgs: [
epkgs.treesit-grammars.with-all-grammars
# Add additional Emacs packages from nixpkgs here if needed
# epkgs.vterm # Already provided by Doom's :term vterm module
];
# Tools added to Emacs's PATH
# Defaults to git, ripgrep, and fd - extend if needed
extraBinPackages = with pkgs; [
git
ripgrep
fd
# Additional CLI tools for development
nixfmt-rfc-style # Nix formatting
shellcheck # Shell script linting
nodePackages.bash-language-server # Bash LSP
];
# Set to false if you want doom-emacs binary separate from emacs
# (useful if you want vanilla Emacs alongside Doom)
provideEmacs = true;
# Enable experimental fetchTree for more efficient package fetching
# May help with "Cannot find Git revision" errors on newer Nix versions
# experimentalFetchTree = true;
};
# Emacs daemon service (optional - uncomment to enable)
# When programs.doom-emacs.provideEmacs = true, this uses Doom Emacs
# services.emacs = {
# enable = true;
# defaultEditor = true;
# };
# Ensure doom directories exist
home.file.".local/share/nix-doom/.keep".text = "";
# Install fonts referenced in doom.d/config.el
home.packages = with pkgs; [
jetbrains-mono
inter
];
}