diff options
author | Michael Raskin <7c6f434c@mail.ru> | 2008-03-07 05:54:54 +0000 |
---|---|---|
committer | Michael Raskin <7c6f434c@mail.ru> | 2008-03-07 05:54:54 +0000 |
commit | 7786a5ad1e5b78c07a1d5f0c788b89bae03408f4 (patch) | |
tree | 6daace72456ff90d00b74503dcba73a95a302c51 /pkgs/servers/dict/dictd-db-collector.nix | |
parent | 8b48a5c7311bf09f64ec7bd2a0e0b45cb1ee9c35 (diff) | |
download | nixlib-7786a5ad1e5b78c07a1d5f0c788b89bae03408f4.tar nixlib-7786a5ad1e5b78c07a1d5f0c788b89bae03408f4.tar.gz nixlib-7786a5ad1e5b78c07a1d5f0c788b89bae03408f4.tar.bz2 nixlib-7786a5ad1e5b78c07a1d5f0c788b89bae03408f4.tar.lz nixlib-7786a5ad1e5b78c07a1d5f0c788b89bae03408f4.tar.xz nixlib-7786a5ad1e5b78c07a1d5f0c788b89bae03408f4.tar.zst nixlib-7786a5ad1e5b78c07a1d5f0c788b89bae03408f4.zip |
Some updates to dict dictionaries.
svn path=/nixpkgs/trunk/; revision=11005
Diffstat (limited to 'pkgs/servers/dict/dictd-db-collector.nix')
-rw-r--r-- | pkgs/servers/dict/dictd-db-collector.nix | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/pkgs/servers/dict/dictd-db-collector.nix b/pkgs/servers/dict/dictd-db-collector.nix new file mode 100644 index 000000000000..91cebac5c475 --- /dev/null +++ b/pkgs/servers/dict/dictd-db-collector.nix @@ -0,0 +1,76 @@ +{stdenv, lib, dict}: +({dictlist, allowList ? ["127.0.0.1"], denyList ? []}: +/* + dictlist is a list of form + [ { filename = /path/to/files/basename; + name = "name"; } ] + basename.dict.dz and basename.index should be + dict files. Or look below for other options. + allowList is a list of IP/domain *-wildcarded strings + denyList is the same.. +*/ + +let + link_arguments = map + (x: '' "${x.filename}" '') + dictlist; + databases = lib.concatStrings (map (x : + " + database ${x.name} { + data ${x.filename}.dict.dz + index ${x.filename}.index + index_word ${x.filename}.word + index_suffix ${x.filename}.suffix + } + ") dictlist); + allow = lib.concatStrings (map (x: "allow ${x}\n") allowList); + deny = lib.concatStrings (map (x: "deny ${x}\n") denyList); + accessSection = " + access { + ${allow} + ${deny} + } + "; + installPhase = '' + ensureDir $out/share/dictd + cd $out/share/dictd + for j in ${toString link_arguments}; do + if test -d "$j"; then + if test -d "$j"/share/dictd ; then + echo "Got store path $j" + j="$j"/share/dictd + fi + echo "Directory reference: $j" + i=$(ls "$j"/*.index) + i="''${i%.index}"; + else + i="$j"; + fi + echo "Basename is $i" + if test -e "$i".dict.dz; then + ln -s "$i".dict.dz + else + cp "$i".dict . + dictzip "$(basename "$i")".dict + fi + ln -s "$i".index . + locale=$(cat "$(dirname "$i")"/locale) + LC_ALL=$locale dictfmt_index2word < "$(basename "$i")".index > "$(basename "$i")".word || true + LC_ALL=$locale dictfmt_index2suffix < "$(basename "$i")".index > "$(basename "$i")".suffix || true + done + echo "${accessSection}" > dictd.conf + cat <<EOF >> dictd.conf +${databases} +EOF + ''; + +in + +stdenv.mkDerivation { + name = "dictd-dbs"; + + phases = ["installPhase"]; + buildInputs = [dict]; + + inherit installPhase; +}) |