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.

warning

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 hunspellDicts.de-de 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
SEARCH PATH:
.::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/home/martin/.openoffice.org/3/user/wordbook:/home/martin/.openoffice.org2/user/wordbook:/home/martin/.openoffice.org2.0/user/wordbook:/home/martin/Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo
AVAILABLE DICTIONARIES (path is not mandatory for -d option):

I suppose I could download the dictionary and put it into /home/martin/.openoffice.org/3/user/wordbook, 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 https://github.com/NixOS/nixpkgs/pull/65349.

and then install it to your profile with:

nix-env -iA nixos.hunspellDicts.de-de
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.