From 5ec374830995b705cae116ea14e6190f8c4d3a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 22 Jun 2022 15:54:04 +0200 Subject: Add sdcv and stardict dictionaries --- nixos/modules/desktop.nix | 2 ++ pkgs/default.nix | 10 ++++++---- pkgs/python/notify-send.nix | 17 ----------------- pkgs/sdcv/default.nix | 26 ++++++++++++++++++++++++++ pkgs/sdcv/wrapper.nix | 37 +++++++++++++++++++++++++++++++++++++ pkgs/stardict/cz.nix | 22 ++++++++++++++++++++++ pkgs/stardict/de-cz.nix | 23 +++++++++++++++++++++++ pkgs/stardict/en-cz.nix | 23 +++++++++++++++++++++++ 8 files changed, 139 insertions(+), 21 deletions(-) delete mode 100644 pkgs/python/notify-send.nix create mode 100644 pkgs/sdcv/default.nix create mode 100644 pkgs/sdcv/wrapper.nix create mode 100644 pkgs/stardict/cz.nix create mode 100644 pkgs/stardict/de-cz.nix create mode 100644 pkgs/stardict/en-cz.nix diff --git a/nixos/modules/desktop.nix b/nixos/modules/desktop.nix index 1958699..5fb196b 100644 --- a/nixos/modules/desktop.nix +++ b/nixos/modules/desktop.nix @@ -67,6 +67,8 @@ in { sound-theme-freedesktop gucharmap + (sdcv.withDictionaries [ stardict-en-cz stardict-de-cz stardict-cz ]) + samba cifs-utils tigervnc freerdp diff --git a/pkgs/default.nix b/pkgs/default.nix index ff1ceea..64de2ac 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -18,10 +18,12 @@ let swaybackground = callPackage ./theme/swaybackground.nix { }; myswaylock = callPackage ./theme/myswaylock.nix { }; - #personalPython3Packages = python3.withPackages (pythonPackages: - #with pythonPackages; [ - # (pythonPackages.callPackage ./python/notify-send.nix { }) - #]); + sdcv-unwrapped = callPackage ./sdcv { }; + sdcv = callPackage ./sdcv/wrapper.nix { }; + stardict-en-cz = callPackage ./stardict/en-cz.nix { }; + stardict-de-cz = callPackage ./stardict/de-cz.nix { }; + stardict-cz = callPackage ./stardict/cz.nix { }; + ferdium = callPackage ./ferdium { mkFranzDerivation = callPackage ( nixpkgs.path + "/pkgs/applications/networking/instant-messengers/franz/generic.nix" diff --git a/pkgs/python/notify-send.nix b/pkgs/python/notify-send.nix deleted file mode 100644 index 8dfe953..0000000 --- a/pkgs/python/notify-send.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ lib, buildPythonPackage, fetchPypi }: - -buildPythonPackage rec { - pname = "notify-send"; - version = "0.0.20"; - - src = fetchPypi { - inherit pname version; - sha256 = "6fddbc5b201728984d2de809959bb6aecf9abb0de5cfa55c7324ca6f48f41e03"; - }; - - meta = with lib; { - description = "Notify send"; - homepage = "https://pypi.org/project/notify-send"; - license = licenses.gpl3; - }; -} diff --git a/pkgs/sdcv/default.nix b/pkgs/sdcv/default.nix new file mode 100644 index 0000000..7e9527f --- /dev/null +++ b/pkgs/sdcv/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub +, cmake, pkg-config, gettext +, zlib, glib, pcre, readline +}: + +stdenv.mkDerivation rec { + pname = "sdcv"; + version = "0.5.3"; + + src = fetchFromGitHub { + owner = "Dushistov"; + repo = pname; + rev = "d054adb37c635ececabc31b147c968a480d1891a"; + hash = "sha256-mJ9LrQ/l0SRmueg+IfGnS0NcNheGdOZ2Gl7KMFiK6is="; + }; + + nativeBuildInputs = [ cmake pkg-config gettext ]; + buildInputs = [ zlib glib pcre readline ]; + makeFlags = "sdcv lang"; + + meta = with lib; { + description = "Console version of Stardict program"; + homepage = "https://dushistov.github.io/sdcv/"; + license = licenses.gpl2; + }; +} diff --git a/pkgs/sdcv/wrapper.nix b/pkgs/sdcv/wrapper.nix new file mode 100644 index 0000000..e26c58c --- /dev/null +++ b/pkgs/sdcv/wrapper.nix @@ -0,0 +1,37 @@ +{ lib, stdenv, makeBinaryWrapper +, sdcv-unwrapped +}: + +with sdcv-unwrapped; + +let + + drv = stdenv.mkDerivation rec { + inherit pname; + inherit version; + inherit meta; + + nativeBuildInputs = [ sdcv-unwrapped 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 + makeWrapper ${sdcv-unwrapped}/bin/sdcv $out/bin/sdcv \ + --set STARDICT_DATA_DIR $out/usr/share/stardict/dic + ''; + + passthru.withDictionaries = dicts: drv.overrideAttrs (oldAttrs: { + dictionaries = dicts; + }); + }; + +in drv diff --git a/pkgs/stardict/cz.nix b/pkgs/stardict/cz.nix new file mode 100644 index 0000000..7b4eeb0 --- /dev/null +++ b/pkgs/stardict/cz.nix @@ -0,0 +1,22 @@ +{ lib, stdenvNoCC, fetchurl }: + +stdenvNoCC.mkDerivation rec { + pname = "stardict-cz"; + version = "20171101"; + + src = fetchurl { + url = "https://dl.cihar.com/slovnik/stable/stardict-czech-${version}.tar.gz"; + sha256 = "14kch0cms3d77js2kyx7risadlzk3waig22gch59qp9y86b9w0zz"; + }; + + installPhase = '' + mkdir -p $out/usr/share/stardict/dic + cp czech-cizi.* $out/usr/share/stardict/dic/ + ''; + + meta = with lib; { + description = "Czech dictionary of foreign words for stardict"; + homepage = "http://slovnik.zcu.cz/"; + license = licenses.gpl3; + }; +} diff --git a/pkgs/stardict/de-cz.nix b/pkgs/stardict/de-cz.nix new file mode 100644 index 0000000..8ef3923 --- /dev/null +++ b/pkgs/stardict/de-cz.nix @@ -0,0 +1,23 @@ +{ lib, stdenvNoCC, fetchurl }: + +stdenvNoCC.mkDerivation rec { + pname = "stardict-de-cz"; + version = "20200501"; + + src = fetchurl { + url = "http://dl.cihar.com/slovnik/stable/stardict-german-czech-${version}.tar.gz"; + sha256 = "1d91pmflaz9zgblalk9b2ib6idj6akm64wvslmzsydwn738n6va2"; + }; + + installPhase = '' + mkdir -p $out/usr/share/stardict/dic + cp czech-german.* $out/usr/share/stardict/dic/ + cp german-czech.* $out/usr/share/stardict/dic/ + ''; + + meta = with lib; { + description = "GNU/FDL German-Czech dictionary for StarDict"; + homepage = "http://slovnik.zcu.cz/"; + license = licenses.gpl3; + }; +} diff --git a/pkgs/stardict/en-cz.nix b/pkgs/stardict/en-cz.nix new file mode 100644 index 0000000..353334c --- /dev/null +++ b/pkgs/stardict/en-cz.nix @@ -0,0 +1,23 @@ +{ lib, stdenvNoCC, fetchurl }: + +stdenvNoCC.mkDerivation rec { + pname = "stardict-en-cz"; + version = "20210401"; + + src = fetchurl { + url = "http://dl.cihar.com/slovnik/stable/stardict-english-czech-${version}.tar.gz"; + sha256 = "1rh2ybqwzw258g4d4aydc587mbqqq7m7fzkxq9kf3b7x9xqzx6ia"; + }; + + installPhase = '' + mkdir -p $out/usr/share/stardict/dic + cp czech-english.* $out/usr/share/stardict/dic/ + cp english-czech.* $out/usr/share/stardict/dic/ + ''; + + meta = with lib; { + description = "GNU/FDL English-Czech dictionary for StarDict"; + homepage = "http://slovnik.zcu.cz/"; + license = licenses.gpl3; + }; +} -- cgit v1.2.3