blob: 4bfe201beb4841c139dc7d89c694e696abec3a2a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
{ lib, stdenv, fetchFromGitHub, unzip, zip, libiconv, perl, aspell, dos2unix
, singleWordlist ? null
}:
stdenv.mkDerivation rec {
pname = "scowl";
version = "2020.12.07";
src = fetchFromGitHub {
owner = "en-wl";
repo = "wordlist";
rev = "rel-${version}";
sha256 = "sha256-J61jhpnZcXMnoGlSuSCrKDZnnyp3Snjr+fUpTVKX64g=";
};
postPatch = ''
substituteInPlace scowl/src/Makefile \
--replace g++ c++
'';
nativeBuildInputs = [ unzip zip perl aspell dos2unix ];
buildInputs = lib.optional (!stdenv.isLinux) libiconv;
env.NIX_CFLAGS_COMPILE = "-Wno-narrowing";
preConfigure = ''
patchShebangs .
export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}$PWD/varcon"
'';
postBuild = lib.optionalString (singleWordlist == null) ''
(
cd scowl/speller
make aspell
make hunspell
)
'';
enableParallelBuilding = false;
installPhase = if singleWordlist == null then ''
eval "$preInstall"
mkdir -p "$out/share/scowl"
mkdir -p "$out/lib" "$out/share/hunspell" "$out/share/myspell"
mkdir -p "$out/share/dict"
cp -r scowl/speller/aspell "$out/lib/aspell"
cp scowl/speller/*.{aff,dic} "$out/share/hunspell"
ln -s "$out/share/hunspell" "$out/share/myspell/dicts"
cp scowl/final/* "$out/share/scowl"
(
cd scowl
for region in american british british_s british_z canadian australian; do
case $region in
american)
regcode=en-us;
;;
british)
regcode=en-gb-ise;
;;
british_s)
regcode=en-gb-ise;
;;
british_z)
regcode=en-gb-ize;
;;
canadian)
regcode=en-ca;
;;
australian)
regcode=en-au;
;;
esac
regcode_var="$regcode"
if test "$region" = british; then
regcode_var="en-gb"
fi
echo $region $regcode $regcode_sz
for s in 10 20 30 35 40 50 55 60 70 80 90 95; do
./mk-list $regcode $s > "$out/share/dict/w$region.$s"
./mk-list --variants=1 $regcode_var $s > "$out/share/dict/w$region.variants.$s"
./mk-list --variants=2 $regcode_var $s > "$out/share/dict/w$region.acceptable.$s"
done
./mk-list $regcode 60 > "$out/share/dict/w$region.txt"
./mk-list --variants=1 $regcode_var 60 > "$out/share/dict/w$region.variants.txt"
./mk-list --variants=2 $regcode_var 80 > "$out/share/dict/w$region.scrabble.txt"
done
./mk-list --variants=1 en-gb 60 > "$out/share/dict/words.variants.txt"
./mk-list --variants=1 en-gb 80 > "$out/share/dict/words.scrabble.txt"
./mk-list en-gb-ise 60 > "$out/share/dict/words.txt"
)
eval "$postInstall"
'' else ''
mkdir -p "$out/share/dict"
cd scowl
./mk-list ${singleWordlist} > "$out/share/dict/words.txt"
'';
meta = {
description = "Spell checker oriented word lists";
license = lib.licenses.mit;
maintainers = [lib.maintainers.raskin];
platforms = lib.platforms.unix;
homepage = "http://wordlist.aspell.net/";
};
}
|