{ pkgs, lib, ... }: let ## Remove flags from words processHunspellDict = filename: let content = builtins.readFile filename; # Remove first line, which is a word count, then split on newlines lines = builtins.tail (lib.splitString "\n" content); # Remove flags at the end of words result = builtins.concatStringsSep "\n" (map (line: builtins.head (lib.splitString "/" line) ) lines); in result; in { programs.nixvim = { plugins.blink-cmp-dictionary = { enable = true; }; extraPackages = with pkgs; [ wordnet ]; }; environment.etc = { "dictionaries/english-words.txt" = { text = processHunspellDict "${pkgs.hunspellDicts.en-us-large}/share/hunspell/en_US.dic"; mode = "0444"; }; }; }