ding: init at 1.8 (close #11989)

vcunat improved meta.
This commit is contained in:
Reno Reckling 2015-12-29 15:29:35 +01:00 committed by Vladimír Čunát
parent bea60e1409
commit a1e0894cb4
4 changed files with 85 additions and 0 deletions

View File

@ -99,6 +99,7 @@
ericsagnes = "Eric Sagnes <eric.sagnes@gmail.com>";
erikryb = "Erik Rybakken <erik.rybakken@math.ntnu.no>";
ertes = "Ertugrul Söylemez <ertesx@gmx.de>";
exi = "Reno Reckling <nixos@reckling.org>";
exlevan = "Alexey Levan <exlevan@gmail.com>";
falsifian = "James Cook <james.cook@utoronto.ca>";
flosse = "Markus Kohlhase <mail@markus-kohlhase.de>";

View File

@ -0,0 +1,53 @@
{ aspell, aspellDicts_de, aspellDicts_en, buildEnv, fetchurl, fortune, gnugrep, makeWrapper, stdenv, tk, tre }:
let
aspellEnv = buildEnv {
name = "env-ding-aspell";
paths = [
aspell
aspellDicts_de
aspellDicts_en
];
};
in
stdenv.mkDerivation rec {
name = "ding-1.8";
src = fetchurl {
url = "http://ftp.tu-chemnitz.de/pub/Local/urz/ding/${name}.tar.gz";
sha256 = "00z97ndwmzsgig9q6y98y8nbxy76pyi9qyj5qfpbbck24gakpz5l";
};
buildInputs = [ aspellEnv fortune gnugrep makeWrapper tk tre ];
patches = [ ./dict.patch ];
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/dict
mkdir -p $out/share/man/man1
mkdir -p $out/share/applications
mkdir -p $out/share/pixmaps
for f in ding ding.1; do
sed -i "s@/usr/share@$out/share@g" "$f"
done
sed -i "s@/usr/bin/fortune@fortune@g" ding
cp ding $out/bin/
cp de-en.txt $out/share/dict/
cp ding.1 $out/share/man/man1/
cp ding.png $out/share/pixmaps/
cp ding.desktop $out/share/applications/
wrapProgram $out/bin/ding --prefix PATH : ${gnugrep}/bin:${aspellEnv}/bin:${tk}/bin:${fortune}/bin --prefix ASPELL_CONF : "\"prefix ${aspellEnv};\""
'';
meta = with stdenv.lib; {
description = "Simple and fast dictionary lookup tool";
homepage = https://www-user.tu-chemnitz.de/~fri/ding/;
license = licenses.gpl2Plus;
platforms = platforms.linux; # homepage says: unix-like except darwin
maintainers = [ maintainers.exi ];
};
}

View File

@ -0,0 +1,26 @@
Ding persists its settings to $HOME/.dingrc on startup, this sadly includes the path to the dictionary.
On all other distributions, that would be /usr/share/dict/de-en.txt and would hardly ever change.
On nixos, this will indeed change on ever update and would break it for all users.
This just comments out the dictionary path in the .dingrc so the user can still set it if she wants to, but it will not affect normal operations.
--- a/ding
+++ b/ding
@@ -899,7 +899,9 @@ if { ! [info exists ding_version]} {
}
# Change path of default ger-eng.txt when upgrading from version 1.1
- if {$searchmeth($i,dictfile) == {/usr/dict/ger-eng.txt} &&
+ if {! [info exists searchmeth($i,dictfile)]} {
+ set searchmeth($i,dictfile) $default_searchmeth(0,dictfile)
+ } elseif {$searchmeth($i,dictfile) == {/usr/dict/ger-eng.txt} &&
$ding_version == {1.1}} {
set searchmeth($i,dictfile) $default_searchmeth(0,dictfile)
debug 2 "New path and name of ger-eng.txt configured: $default_searchmeth(0,dictfile)"
@@ -5065,7 +5067,7 @@ proc saveOptions {} {
foreach i $searchmpos {
puts $fd "set searchmeth($n,name) {$searchmeth($i,name)}"
puts $fd "set searchmeth($n,type) {$searchmeth($i,type)}"
- puts $fd "set searchmeth($n,dictfile) {$searchmeth($i,dictfile)}"
+ puts $fd "#set searchmeth($n,dictfile) {$searchmeth($i,dictfile)}"
puts $fd "set searchmeth($n,separator) {$searchmeth($i,separator)}"
puts $fd "set searchmeth($n,language1) {$searchmeth($i,language1)}"
puts $fd "set searchmeth($n,language2) {$searchmeth($i,language2)}"

View File

@ -813,6 +813,11 @@ let
dialog = callPackage ../development/tools/misc/dialog { };
ding = callPackage ../applications/misc/ding {
aspellDicts_de = aspellDicts.de;
aspellDicts_en = aspellDicts.en;
};
direnv = callPackage ../tools/misc/direnv { };
discount = callPackage ../tools/text/discount { };