Skip to content

Commit

Permalink
feat(skk-jisyo): init at unstable-2023-02-07
Browse files Browse the repository at this point in the history
  • Loading branch information
midchildan committed Nov 9, 2023
1 parent 0887862 commit a5b3179
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 4 deletions.
7 changes: 5 additions & 2 deletions nix/home/modules/aquaskk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ let
cfg = config.dotfiles.aquaskk;
dictTypes = [ "euc-jp" "online" "skkserv" "kotoeri" "program" "utf-8" ];

inherit (pkgs.stdenv.hostPlatform) system;
myPkgs = dotfiles.packages.${system};

dictionarySet = lib.mapAttrsToList
(name: config: {
inherit (config) active location;
Expand Down Expand Up @@ -53,8 +56,8 @@ in

default = {
"SKK-JISYO.L" = {
location = "${pkgs.skk-dicts}/share/SKK-JISYO.L";
type = "utf-8";
location = "${myPkgs.skk-jisyo-l}/share/skk/SKK-JISYO.L";
type = "euc-jp";
};
};

Expand Down
22 changes: 21 additions & 1 deletion nix/home/profiles/macos.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, dotfiles, ... }:

let
inherit (lib) mkDefault mkEnableOption mkIf;
inherit (pkgs.stdenv.hostPlatform) system;
myPkgs = dotfiles.packages.${system};
in
{
options.dotfiles.profiles.macos.enable =
Expand Down Expand Up @@ -86,6 +88,24 @@ in
enable_extended_completion = mkDefault true;
show_input_mode_icon = mkDefault true;
};
dictionaries = {
"SKK-JISYO.propernoun" = {
location = "${myPkgs.skk-jisyo-propernoun}/share/skk/SKK-JISYO.propernoun";
type = "euc-jp";
};
"SKK-JISYO.zipcode" = {
location = "${myPkgs.skk-jisyo-zipcode}/share/skk/SKK-JISYO.zipcode";
type = "euc-jp";
};
"SKK-JISYO.office.zipcode" = {
location = "${myPkgs.skk-jisyo-zipcode}/share/skk/SKK-JISYO.office.zipcode";
type = "euc-jp";
};
"SKK-JISYO.emoji" = {
location = "${myPkgs.skk-jisyo-emoji}/share/skk/SKK-JISYO.emoji";
type = "utf-8";
};
};
};
};
}
2 changes: 1 addition & 1 deletion nix/packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ rec {
inherit (inputs) darwin;
};

}
} // pkgs.callPackages ./skk-jisyo.nix { }
190 changes: 190 additions & 0 deletions nix/packages/skk-jisyo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{ lib
, stdenvNoCC
, fetchFromGitHub
, nix-update-script
, nkf
, useUtf8 ? false
}:

let
pkgPrefix = "skk-jisyo-";
suffix = lib.optionalString useUtf8 ".utf8";

mkDictNameValue =
{ name
, description
, license # it's written in the beginning of each file
, files ? [ "SKK-JISYO.${name}" ]
}: {
name =
pkgPrefix + lib.toLower (builtins.replaceStrings [ "." ] [ "_" ] name);

value = stdenvNoCC.mkDerivation {
pname = pkgPrefix + lib.toLower name;
version = "unstable-2023-02-07";

src = fetchFromGitHub {
owner = "skk-dev";
repo = "dict";
rev = "1909dda026e6038975359a5eaeafcf50c9ce7fa3";
sha256 = "sha256-e7B1+ji/8ssM92RSTmlu8c7V5kbk93CxtUDzs26gE8s=";
};

nativeBuildInputs = lib.optionals useUtf8 [ nkf ];

buildPhase = ''
runHook preBuild
'' + lib.concatMapStrings
(file: ''
nkf -w ${file} \
| LC_ALL=C sed 's/coding: [^ ]\{1,\}/coding: utf-8/' \
> ${file + suffix}
'')
(lib.optionals useUtf8 (map lib.escapeShellArg files)) + ''
runHook postBuild
'';

installPhase = ''
runHook preInstall
'' + lib.concatMapStrings
(file: ''
install -Dm644 \
${lib.escapeShellArg file} \
$out/share/skk/${lib.escapeShellArg (baseNameOf file)}
'')
(map (file: file + suffix) files) + ''
runHook postInstall
'';

passthru.updateScript = nix-update-script {
extraArgs = [ "--version" "branch" ];
};

meta = with lib; {
inherit description license;
homepage = "https://github.com/skk-dev/dict";
platforms = platforms.all;
};
};
};
in
lib.listToAttrs (map mkDictNameValue [
{
name = "L";
description = "The standard SKK dictionary";
license = lib.licenses.gpl2Plus;
}
{
name = "S";
description = "Small SKK dictionary";
license = lib.licenses.gpl2Plus;
}
{
name = "M";
description = "Medium sized SKK dictionary";
license = lib.licenses.gpl2Plus;
}
{
name = "ML";
description = "Medium to large sized SKK dictionary";
license = lib.licenses.gpl2Plus;
}
{
name = "jinmei";
description = "SKK dictionary for names";
license = lib.licenses.gpl2Plus;
}
{
name = "fullname";
description = "SKK dictionary for celebrities";
license = lib.licenses.gpl2Plus;
}
{
name = "geo";
description = "SKK dictionary for locations";
license = lib.licenses.gpl2Plus;
}
{
name = "propernoun";
description = "SKK dictionary for proper nouns";
license = lib.licenses.gpl2Plus;
}
{
name = "station";
description = "SKK dictionary for stations";
license = lib.licenses.gpl2Plus;
}
{
name = "law";
description = "SKK dictionary for legal terms";
license = lib.licenses.gpl2Plus;
}
{
name = "okinawa";
description = "SKK dictionary for the Okinawan language";
license = lib.licenses.publicDomain;
}
{
name = "china_taiwan";
description = "SKK dictionary for Chinese & Taiwanese locations";
license = lib.licenses.gpl2Plus;
}
{
name = "assoc";
description = "SKK dictionary for abbreviated input";
license = lib.licenses.gpl2Plus;
}
{
name = "edict";
description = "SKK dictionary for English to Japanese translation";
license = lib.licenses.cc-by-sa-30;
}
{
name = "zipcode";
description = "SKK dictionary for Japanese zipcodes";
files = [ "zipcode/SKK-JISYO.zipcode" "zipcode/SKK-JISYO.office.zipcode" ];
license = lib.licenses.publicDomain;
}
{
name = "JIS2";
description = "SKK dictionary for JIS level 2 kanjis";
license = lib.licenses.gpl2Plus;
}
{
name = "JIS3_4";
description = "SKK dictionary for JIS level 3 and 4 kanjis";
license = lib.licenses.gpl2Plus;
}
{
name = "JIS2004";
description = ''
A complementary SKK dictionary for JIS3_4 with JIS X 0213:2004 additions"
'';
license = lib.licenses.gpl2Plus;
}
{
name = "itaiji";
description = "SKK dictionary for variant kanjis";
license = lib.licenses.publicDomain;
}
{
name = "itaiji.JIS3_4";
description = "SKK dictionary for JIS level 3 and 4 variant kanjis";
license = lib.licenses.gpl2Plus;
}
{
name = "mazegaki";
description = "SKK dictionary for mazegaki";
license = lib.licenses.gpl2Plus;
}
{
name = "emoji";
description = "SKK dictionary for emojis";
license = lib.licenses.unicode-dfs-2016;
}
{
name = "pinyin";
description = "SKK dictionary for pinyin to simplified Chinese input";
license = lib.licenses.gpl1Plus;
}
])

0 comments on commit a5b3179

Please sign in to comment.