Atom editor can't find hunspell dictionary

Hi, I am using NixOS 19.03.

The Atom editor has a spell checker. This is a core package (built-in package management) of the editor. When I start Atom, I get the following message.


The spell checker apparently uses hunspell dictionaries. For other Linux distributions, users are advised to install the correct hunspell dictionary. So, I installed hunspell and via /etc/nixos/configuration.nix. I had already guessed that that wouldn’t work and I was not surprised when Atom still could not find the dictionary.

The hunspell command itself can’t find the dictionary:

> hunspell -D
AVAILABLE DICTIONARIES (path is not mandatory for -d option):

I suppose I could download the dictionary and put it into /home/martin/, for example. I then could point the Atom spell-checker to that directory. That should probably work. But if I wanted to download software and resources manually, I would use Windows :wink:. I hope there is a more idiomatic way that leverages Nix.

Could anyone point me in the general direction of a solution? Do I need to hack on the Nix expression for the atom package?

Edit: spelling

I think the best way to make it work on 19.03 is to set this in your profile:

export DICPATH=$HOME/.nix-profile/share/hunspell

This should work out of the box in the future without setting DICPATH

and then install it to your profile with:

nix-env -iA
1 Like

Thanks for your reply. If I set DICPATH to the correct path, hunspell is able to find the dictionary.

I learned that the dictionaries are available at /run/current-system/sw/share/hunspell, if they are installed declaratively via /etc/nixos/configuration.nix. So, I am setting DICPATH to that instead:

export DICPATH=/run/current-system/sw/share/hunspell

Unfortunately, the Atom spell checker does not use DICPATH or XDG_DATA_DIRS. But that’s an issue of the spell checker. For now, I can workaround that by adding /run/current-system/sw/share/hunspell to the list of paths the spell checker searches for dictionaries.