aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-06-22 15:54:04 +0200
committerKarel Kočí <cynerd@email.cz>2022-06-22 15:55:14 +0200
commit5ec374830995b705cae116ea14e6190f8c4d3a29 (patch)
treea59c40d6b8bd95e86df6a0857ff10cbca506aabe
parent5679c4ad2745fbd62a40be8beaa5c68b20c0a6bf (diff)
downloadnixos-personal-5ec374830995b705cae116ea14e6190f8c4d3a29.tar.gz
nixos-personal-5ec374830995b705cae116ea14e6190f8c4d3a29.tar.bz2
nixos-personal-5ec374830995b705cae116ea14e6190f8c4d3a29.zip
Add sdcv and stardict dictionaries
-rw-r--r--nixos/modules/desktop.nix2
-rw-r--r--pkgs/default.nix10
-rw-r--r--pkgs/python/notify-send.nix17
-rw-r--r--pkgs/sdcv/default.nix26
-rw-r--r--pkgs/sdcv/wrapper.nix37
-rw-r--r--pkgs/stardict/cz.nix22
-rw-r--r--pkgs/stardict/de-cz.nix23
-rw-r--r--pkgs/stardict/en-cz.nix23
8 files changed, 139 insertions, 21 deletions
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;
+ };
+}