summary refs log tree commit diff
path: root/pkgs/servers/dict
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2008-03-07 07:30:56 +0000
committerMichael Raskin <7c6f434c@mail.ru>2008-03-07 07:30:56 +0000
commit07cad2fc45f4a912a54f83a624242d71b4ca5a7e (patch)
treea82c0ec82dacd2902fa15d88c110d83abb5c639b /pkgs/servers/dict
parentb20aba1d926a96e15cfa0842e136e4ebf8e91799 (diff)
downloadnixpkgs-07cad2fc45f4a912a54f83a624242d71b4ca5a7e.tar
nixpkgs-07cad2fc45f4a912a54f83a624242d71b4ca5a7e.tar.gz
nixpkgs-07cad2fc45f4a912a54f83a624242d71b4ca5a7e.tar.bz2
nixpkgs-07cad2fc45f4a912a54f83a624242d71b4ca5a7e.tar.lz
nixpkgs-07cad2fc45f4a912a54f83a624242d71b4ca5a7e.tar.xz
nixpkgs-07cad2fc45f4a912a54f83a624242d71b4ca5a7e.tar.zst
nixpkgs-07cad2fc45f4a912a54f83a624242d71b4ca5a7e.zip
Now Dictd dictionary collection works to full extent.
svn path=/nixpkgs/trunk/; revision=11007
Diffstat (limited to 'pkgs/servers/dict')
-rw-r--r--pkgs/servers/dict/dictd-db-collector.nix38
-rw-r--r--pkgs/servers/dict/dictd-db.nix35
2 files changed, 53 insertions, 20 deletions
diff --git a/pkgs/servers/dict/dictd-db-collector.nix b/pkgs/servers/dict/dictd-db-collector.nix
index 91cebac5c47..299bfc8ac2f 100644
--- a/pkgs/servers/dict/dictd-db-collector.nix
+++ b/pkgs/servers/dict/dictd-db-collector.nix
@@ -15,14 +15,7 @@ let
 			(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);
+		"${x.name}	${x.filename}\n") dictlist);
 	allow = lib.concatStrings (map (x: "allow ${x}\n") allowList);
 	deny = lib.concatStrings (map (x: "deny ${x}\n") denyList);
 	accessSection = "
@@ -34,34 +27,45 @@ let
 	installPhase = ''  
   	ensureDir $out/share/dictd
 	cd $out/share/dictd
+	echo "${databases}" >databases.names 
+	echo "${accessSection}" > dictd.conf
 	for j in ${toString link_arguments}; do 
+		name="$(egrep '	'"$j"\$ databases.names)"
+		name=''${name%	$j}
 		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=$(ls "$j""/"*.index)
 			i="''${i%.index}";
 		else
 			i="$j";
 		fi
 		echo "Basename is $i"
+		locale=$(cat "$(dirname "$i")"/locale)
+		base="$(basename "$i")"
+		echo "Locale is $locale"
+		export LC_ALL=$locale 
+		export LANG=$locale 
 		if test -e "$i".dict.dz; then
 			ln -s "$i".dict.dz
 		else
 			cp "$i".dict .
-			dictzip "$(basename "$i")".dict
+			dictzip "$base".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
+		dictfmt_index2word --locale $locale < "$base".index > "$base".word || true
+		dictfmt_index2suffix --locale $locale < "$base".index > "$base".suffix || true
+
+		echo "database $name {" >> dictd.conf
+		echo "  data $out/share/dictd/$base.dict.dz" >> dictd.conf
+		echo "  index $out/share/dictd/$base.index" >> dictd.conf
+		echo "  index_word $out/share/dictd/$base.word" >> dictd.conf
+		echo "  index_suffix $out/share/dictd/$base.suffix" >> dictd.conf
+		echo "}" >> dictd.conf
 	done
-	echo "${accessSection}" > dictd.conf
-	cat <<EOF >> dictd.conf
-${databases}
-EOF
   	'';
 
 in
diff --git a/pkgs/servers/dict/dictd-db.nix b/pkgs/servers/dict/dictd-db.nix
index a93e0629f2e..15503e44812 100644
--- a/pkgs/servers/dict/dictd-db.nix
+++ b/pkgs/servers/dict/dictd-db.nix
@@ -36,7 +36,7 @@ fetchurl = (builderDefs {src="";} null).fetchurl;
 
 in 
 
-{
+rec {
 	nld2eng = makeDictdDBFreedict (fetchurl {
 		url = http://prdownloads.sourceforge.net/freedict/nld-eng.tar.gz;
 		sha256 = "1vhw81pphb64fzsjvpzsnnyr34ka2fxizfwilnxyjcmpn9360h07";
@@ -57,9 +57,38 @@ in
 		url = http://downloads.sourceforge.net/freedict/eng-fra.tar.gz;
 		sha256 = "0fi6rrnbqnhc6lq8d0nmn30zdqkibrah0mxfg27hsn9z7alwbj3m";
 	}) "eng-fra" "en_UK";
-	mueller_eng2rus = makeDictdDB (fetchurl {
+	mueller_eng2rus_pkg = makeDictdDB (fetchurl {
 		url = http://downloads.sourceforge.net/mueller-dict/mueller-dict-3.1.tar.gz;
 		sha256 = "04r5xxznvmcb8hkxqbjgfh2gxvbdd87jnhqn5gmgvxxw53zpwfmq";
 	}) "mueller-eng-rus" "mueller-dict-*/dict" "en_UK";
-	
+	mueller_enru_abbr = {
+		outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-abbrev";
+		name = "mueller-abbr";
+		dbName = "mueller-abbr";
+		locale = "en_UK";
+	};
+	mueller_enru_base = {
+		outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-base";
+		name = "mueller-base";
+		dbName = "mueller-base";
+		locale = "en_UK";
+	};
+	mueller_enru_dict = {
+		outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-dict";
+		name = "mueller-dict";
+		dbName = "mueller-dict";
+		locale = "en_UK";
+	};
+	mueller_enru_geo = {
+		outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-geo";
+		name = "mueller-geo";
+		dbName = "mueller-geo";
+		locale = "en_UK";
+	};
+	mueller_enru_names = {
+		outPath = "${mueller_eng2rus_pkg}/share/dictd/mueller-names";
+		name = "mueller-names";
+		dbName = "mueller-names";
+		locale = "en_UK";
+	};
 }