about summary refs log tree commit diff
path: root/pkgs/by-name/su/sudachidict/package.nix
blob: 7245b9696bf2a3fec3431c6f265abd5afa0f3a70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, stdenvNoCC
, fetchzip
, dict-type ? "core"
}:

let
  pname = "sudachidict";
  version = "20230927";

  srcs = {
    core = fetchzip {
      url = "https://github.com/WorksApplications/SudachiDict/releases/download/v${version}/sudachi-dictionary-${version}-core.zip";
      hash = "sha256-c88FfC03AU8eP37RVu9M3BAIlwFlTJqQJ60PK94mHOc=";
    };
    small = fetchzip {
      url = "https://github.com/WorksApplications/SudachiDict/releases/download/v${version}/sudachi-dictionary-${version}-small.zip";
      hash = "sha256-eaYD2C/qPeZJvmOeqH307a6OXtYfuksf6VZt+9kM7eM=";
    };
    full = fetchzip {
      url = "https://github.com/WorksApplications/SudachiDict/releases/download/v${version}/sudachi-dictionary-${version}-full.zip";
      hash = "sha256-yiO33UUQHcf6LvHJ1Is4MJtI5GSHuIP/tsE9m/KZ01o=";
    };
  };
in

lib.checkListOfEnum "${pname}: dict-type" [ "core" "full" "small" ] [ dict-type ]

stdenvNoCC.mkDerivation {
  inherit pname version;

  src = srcs.${dict-type};

  dontConfigure = true;

  dontBuild = true;

  installPhase = ''
    runHook preInstall

    install -Dm644 system_${dict-type}.dic $out/share/system.dic

    runHook postInstall
  '';

  passthru = {
    dict-type = dict-type;
  };

  meta = with lib; {
    description = "A lexicon for Sudachi";
    homepage = "https://github.com/WorksApplications/SudachiDict";
    changelog = "https://github.com/WorksApplications/SudachiDict/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ natsukium ];
    platforms = platforms.all;
    # it is a waste of space and time to build this package in hydra since it is just data
    hydraPlatforms = [];
  };
}