Skip to content

Commit

Permalink
scowl: support installing just words.txt
Browse files Browse the repository at this point in the history
The expression now supports having `words.txt` in some place without tens
and tens of megabytes of all the wordlist and spelling dictionaries. Set
`singleWordlist` parameter to the string of region and size settings. For
example:
```
scowl.override{singleWordlist = "en-gb-ise 60";}
```

Should be useful for #34486
  • Loading branch information
7c6f434c committed Feb 2, 2018
1 parent a417040 commit 00cafb4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkgs/data/misc/scowl/default.nix
@@ -1,4 +1,4 @@
{stdenv, fetchFromGitHub, unzip, zip, perl, aspell, dos2unix}:
{stdenv, fetchFromGitHub, unzip, zip, perl, aspell, dos2unix, singleWordlist ? null}:
stdenv.mkDerivation rec {
name = "${pname}-${version}";
pname = "scowl";
Expand All @@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}$PWD/varcon"
'';

postBuild = ''
postBuild = stdenv.lib.optionalString (singleWordlist == null) ''
(
cd scowl/speller
make aspell
Expand All @@ -31,7 +31,7 @@ stdenv.mkDerivation rec {

enableParallelBuilding = false;

installPhase = ''
installPhase = if singleWordlist == null then ''
eval "$preInstall"
mkdir -p "$out/share/scowl"
Expand Down Expand Up @@ -73,7 +73,7 @@ stdenv.mkDerivation rec {
fi
echo $region $regcode $regcode_sz
for s in 10 20 30 35 40 50 55 60 70 80 90; do
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"
Expand All @@ -88,6 +88,10 @@ stdenv.mkDerivation rec {
)
eval "$postInstall"
'' else ''
mkdir -p "$out/share/dict"
cd scowl
./mk-list ${singleWordlist} > "$out/share/dict/words.txt"
'';

meta = {
Expand Down

0 comments on commit 00cafb4

Please sign in to comment.