diff options
author | Karel Kočí <cynerd@email.cz> | 2022-06-30 14:32:42 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-06-30 14:36:49 +0200 |
commit | 80372557415a2671584458be4d02cd60bcee0641 (patch) | |
tree | 63a362ec0345409c1fc50390c22b8e0d29a1eeae /pkgs/stardict/wrapper.nix | |
parent | 902f91984818f3ed0ab8b50f95e23aa9b2ab64a0 (diff) | |
download | nixos-personal-80372557415a2671584458be4d02cd60bcee0641.tar.gz nixos-personal-80372557415a2671584458be4d02cd60bcee0641.tar.bz2 nixos-personal-80372557415a2671584458be4d02cd60bcee0641.zip |
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.
Diffstat (limited to 'pkgs/stardict/wrapper.nix')
-rw-r--r-- | pkgs/stardict/wrapper.nix | 40 |
1 files changed, 40 insertions, 0 deletions
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 |