aboutsummaryrefslogtreecommitdiff
path: root/pkgs/sdcv
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/sdcv')
-rw-r--r--pkgs/sdcv/default.nix26
-rw-r--r--pkgs/sdcv/wrapper.nix37
2 files changed, 63 insertions, 0 deletions
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