From 80372557415a2671584458be4d02cd60bcee0641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 30 Jun 2022 14:32:42 +0200 Subject: pkgs/stardict: add stardict itself It seems to not be able to find translations but I am not using it anyway. I have it just for completeness. --- pkgs/stardict/wrapper.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 pkgs/stardict/wrapper.nix (limited to 'pkgs/stardict/wrapper.nix') diff --git a/pkgs/stardict/wrapper.nix b/pkgs/stardict/wrapper.nix new file mode 100644 index 0000000..6547728 --- /dev/null +++ b/pkgs/stardict/wrapper.nix @@ -0,0 +1,40 @@ +{ lib, stdenv, makeBinaryWrapper +, stardict +}: + +with stardict; + +let + + drv = stdenv.mkDerivation rec { + inherit pname; + inherit version; + inherit meta; + + nativeBuildInputs = [ stardict makeBinaryWrapper ]; + dictionaries = [ /* empty and expecting override */ ]; + + phases = [ "installPhase" ]; + installPhase = '' + mkdir -p $out/bin $out/usr/share/stardict/dic + for dic in $dictionaries; do + for path in "$dic"/usr/share/stardict/dic/*; do + [ -f "$path" ] || continue + outln="$out/usr/share/stardict/dic/${"$"}{path##*/}" + [ -e "$outln" ] && continue + ln -sf "$path" "$outln" + done + done + + for bin in ${stardict}/bin/*; do + makeWrapper "$bin" "$out/bin/${"$"}{bin##*/bin/}" \ + --set STARDICT_DATA_DIR "$out/usr/share/stardict/dic" + done + ''; + + passthru.withDictionaries = dicts: drv.overrideAttrs (oldAttrs: { + dictionaries = dicts; + }); + }; + +in drv -- cgit v1.2.3