# 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.) # Supports ~ expansion but NOT shell variables like $XDG_DATA_HOME doomLocalDir = "~/.local/share/nix-doom"; # Use emacs-pgtk for better Wayland support on Linux # On macOS, falls back to regular emacs emacs = if pkgs.stdenv.isLinux then pkgs.emacs-pgtk else pkgs.emacs; # 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 = ""; # Shell aliases for Doom Emacs programs.fish.shellAbbrs = lib.mkIf config.programs.fish.enable { em = "emacsclient -c -a emacs"; et = "emacsclient -t -a 'emacs -nw'"; }; programs.zsh.shellAliases = lib.mkIf config.programs.zsh.enable { em = "emacsclient -c -a emacs"; et = "emacsclient -t -a 'emacs -nw'"; }; programs.bash.shellAliases = lib.mkIf config.programs.bash.enable { em = "emacsclient -c -a emacs"; et = "emacsclient -t -a 'emacs -nw'"; }; }