Files
dotfiles/nix/modules/emacs.nix
2025-04-09 18:56:58 -07:00

38 lines
1.1 KiB
Nix

{ config, lib, pkgs, ... }:
with config.lib.file;
let emacsWithPackages = (pkgs.emacsPackagesFor
(if pkgs.stdenv.hostPlatform.isDarwin
then pkgs.emacs
else pkgs.emacs-pgtk)).emacsWithPackages;
aspell = (pkgs.aspellWithDicts (d: [d.en]));
in
{
home.packages = with pkgs; let
basePackages = [
(emacsWithPackages (epkgs: [
epkgs.melpaPackages.jinx
]))
zstd
emacs-lsp-booster
aspell
];
# Macs need coreutils for dired to work
macPackages = basePackages ++ [ coreutils ];
in
if pkgs.stdenv.hostPlatform.isDarwin
then macPackages else basePackages;
xdg.configFile = {
"emacs".source = mkOutOfStoreSymlink
"${config.home.homeDirectory}/.dotfiles/emacs";
};
# The aspell wrapper created by aspellWithDicts only wraps the
# binary, not the library, so we need to write a config file that
# tells it where to find things for libenchant to work. See:
# https://discourse.nixos.org/t/aspell-dictionaries-are-not-available-to-enchant/39254
home.file.".aspell.conf".text = ''
dict-dir ${aspell}/lib/aspell
'';
}