phonon

Emacs spell checking on NixOS

I've been using Emacs as my main text editor for a little over a year now, and it's been absolutely wonderful. I use it now for all my text editing needs, primarily for writing blog post using org-mode. However, one feature that I was initially missing was spell-checking. I make a lot of typos and being able to easily see where errors are saves a lot of time. Luckily Doom Emacs already has this covered.

To enable spell-checking, one simply has to go into their init.el and enable the following options:

(doom! :input

       ...

       :checkers
       (spell +aspell)

       ...

This enables spell checking with the aspell back-end. To get it to actually work, we still need to install aspell, and some dictionaries. This should be relatively simple for most distros but for NixOS, I found that it has to be done in a slightly work un-intuitive way, as installing Aspell with dictionaries separately means that Aspell is not able to find the dictionaries.

environment.systemPackages = with pkgs; [
(aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]))
]

If you have done both these things, simply rebuilding your system, and rerunning doom-sync should get you working spell-checking with a red-underline indicating a spelling mistake. The short-cuts are quite simple:

There is one caveat, I have not been able to get the add/remove word commands to work. My suspicion is that this is because NixOS probably has read-only dictionaries, and as such they can't be changed. I will need to do some searching to see if anyone has managed to figure out a solution to this.

#Emacs #Nix