btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / su / sudachidict / package.nix
blob744439283367c4cf3363779a702ca399265d50b7
1 { lib
2 , stdenvNoCC
3 , fetchzip
4 , dict-type ? "core"
5 }:
7 let
8   pname = "sudachidict";
9   version = "20241021";
11   srcs = {
12     core = fetchzip {
13       url = "https://github.com/WorksApplications/SudachiDict/releases/download/v${version}/sudachi-dictionary-${version}-core.zip";
14       hash = "sha256-wLcRhR4TCazRxDMKXYZ8T5Vn+rnY6aJmwExIpTIAyeE=";
15     };
16     small = fetchzip {
17       url = "https://github.com/WorksApplications/SudachiDict/releases/download/v${version}/sudachi-dictionary-${version}-small.zip";
18       hash = "sha256-Qhp9seFCnLnLLWoQ2izDVKcdca+xZE1s+SCqfj0d3sU=";
19     };
20     full = fetchzip {
21       url = "https://github.com/WorksApplications/SudachiDict/releases/download/v${version}/sudachi-dictionary-${version}-full.zip";
22       hash = "sha256-8nlUDGHUKrZ0ZFEnnL4rHiu2ybyW25G6Bm6vF4smxWE=";
23     };
24   };
27 lib.checkListOfEnum "${pname}: dict-type" [ "core" "full" "small" ] [ dict-type ]
29 stdenvNoCC.mkDerivation {
30   inherit pname version;
32   src = srcs.${dict-type};
34   dontConfigure = true;
36   dontBuild = true;
38   installPhase = ''
39     runHook preInstall
41     install -Dm644 system_${dict-type}.dic $out/share/system.dic
43     runHook postInstall
44   '';
46   passthru = {
47     dict-type = dict-type;
48   };
50   meta = with lib; {
51     description = "Lexicon for Sudachi";
52     homepage = "https://github.com/WorksApplications/SudachiDict";
53     changelog = "https://github.com/WorksApplications/SudachiDict/releases/tag/v${version}";
54     license = licenses.asl20;
55     maintainers = with maintainers; [ natsukium ];
56     platforms = platforms.all;
57     # it is a waste of space and time to build this package in hydra since it is just data
58     hydraPlatforms = [];
59   };