summary refs log tree commit diff
path: root/pkgs/tools/text
diff options
context:
space:
mode:
authorPavel Sobolev <paveloom@riseup.net>2023-09-26 20:56:22 +0300
committerPavel Sobolev <paveloom@riseup.net>2023-09-26 22:41:10 +0300
commit3042d6245baa46a8cc5d51a417613050cacb21d0 (patch)
tree9fb8d9aa4a2f13e9d201929d5a3bc3c4a3d6e5c7 /pkgs/tools/text
parent7e5e43ef91a3828f92f8dd149d9af6521d0c736b (diff)
downloadnixpkgs-3042d6245baa46a8cc5d51a417613050cacb21d0.tar
nixpkgs-3042d6245baa46a8cc5d51a417613050cacb21d0.tar.gz
nixpkgs-3042d6245baa46a8cc5d51a417613050cacb21d0.tar.bz2
nixpkgs-3042d6245baa46a8cc5d51a417613050cacb21d0.tar.lz
nixpkgs-3042d6245baa46a8cc5d51a417613050cacb21d0.tar.xz
nixpkgs-3042d6245baa46a8cc5d51a417613050cacb21d0.tar.zst
nixpkgs-3042d6245baa46a8cc5d51a417613050cacb21d0.zip
mecab: refactor
Diffstat (limited to 'pkgs/tools/text')
-rw-r--r--pkgs/tools/text/mecab/base.nix19
-rw-r--r--pkgs/tools/text/mecab/default.nix28
-rw-r--r--pkgs/tools/text/mecab/ipadic.nix8
-rw-r--r--pkgs/tools/text/mecab/nodic.nix7
4 files changed, 29 insertions, 33 deletions
diff --git a/pkgs/tools/text/mecab/base.nix b/pkgs/tools/text/mecab/base.nix
index 181eb405cbd..c44c899b82b 100644
--- a/pkgs/tools/text/mecab/base.nix
+++ b/pkgs/tools/text/mecab/base.nix
@@ -1,16 +1,13 @@
 { fetchurl }:
 
-{
-    version = "0.996";
+finalAttrs: {
+  version = "0.996";
 
-    src = fetchurl {
-      url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE";
-      name = "mecab-0.996.tar.gz";
-      sha256 = "0ncwlqxl1hdn1x4v4kr2sn1sbbcgnhdphp0lcvk74nqkhdbk4wz0";
-    };
+  src = fetchurl {
+    url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE";
+    name = "mecab-${finalAttrs.version}.tar.gz";
+    hash = "sha256-4HMyV4MTW3LmZhRceBu0j62lg9UiT7JJD7bBQDumnFk=";
+  };
 
-    buildPhase = ''
-      make
-      make check
-    '';
+  doCheck = true;
 }
diff --git a/pkgs/tools/text/mecab/default.nix b/pkgs/tools/text/mecab/default.nix
index 04293d29efb..58396d2aa46 100644
--- a/pkgs/tools/text/mecab/default.nix
+++ b/pkgs/tools/text/mecab/default.nix
@@ -3,19 +3,19 @@
 let
   mecab-base = import ./base.nix { inherit fetchurl; };
 in
-stdenv.mkDerivation (mecab-base // {
-    pname = "mecab";
-    version = mecab-base.version;
+stdenv.mkDerivation (finalAttrs: ((mecab-base finalAttrs) // {
+  pname = "mecab";
 
-    postInstall = ''
-      sed -i 's|^dicdir = .*$|dicdir = ${mecab-ipadic}|' "$out/etc/mecabrc"
-    '';
+  postInstall = ''
+    sed -i 's|^dicdir = .*$|dicdir = ${mecab-ipadic}|' "$out/etc/mecabrc"
+  '';
 
-    meta = with lib; {
-      description = "Japanese morphological analysis system";
-      homepage = "http://taku910.github.io/mecab/";
-      license = licenses.bsd3;
-      platforms = platforms.unix;
-      maintainers = with maintainers; [ auntie ];
-    };
-})
+  meta = with lib; {
+    description = "Japanese morphological analysis system";
+    homepage = "http://taku910.github.io/mecab";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    mainProgram = "mecab";
+    maintainers = with maintainers; [ auntie paveloom ];
+  };
+}))
diff --git a/pkgs/tools/text/mecab/ipadic.nix b/pkgs/tools/text/mecab/ipadic.nix
index 026e385e7c2..654d4928ee5 100644
--- a/pkgs/tools/text/mecab/ipadic.nix
+++ b/pkgs/tools/text/mecab/ipadic.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, mecab-nodic }:
 
-stdenv.mkDerivation {
+stdenv.mkDerivation (finalAttrs: {
   pname = "mecab-ipadic";
   version = "2.7.0-20070801";
 
   src = fetchurl {
     url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM";
-    name = "mecab-ipadic-2.7.0-20070801.tar.gz";
-    sha256 = "08rmkvj0f0x6jq0axrjw2y5nam0mavv6x77dp9v4al0wi1ym4bxn";
+    name = "mecab-ipadic-${finalAttrs.version}.tar.gz";
+    hash = "sha256-ti9SfYgcUEV2uu2cbvZWFVRlixdc5q4AlqYDB+SeNSM=";
   };
 
   buildInputs = [ mecab-nodic ];
@@ -15,4 +15,4 @@ stdenv.mkDerivation {
   configurePhase = ''
     ./configure --with-dicdir="$out"
   '';
-}
+})
diff --git a/pkgs/tools/text/mecab/nodic.nix b/pkgs/tools/text/mecab/nodic.nix
index be9003623e0..5e33b09db14 100644
--- a/pkgs/tools/text/mecab/nodic.nix
+++ b/pkgs/tools/text/mecab/nodic.nix
@@ -3,7 +3,6 @@
 let
   mecab-base = import ./base.nix { inherit fetchurl; };
 in
-stdenv.mkDerivation (mecab-base // {
-    pname = "mecab-nodic";
-    version = mecab-base.version;
-})
+stdenv.mkDerivation (finalAttrs: ((mecab-base finalAttrs) // {
+  pname = "mecab-nodic";
+}))