{
  pkgs,
  inputs,
  config,
  lib,
  ...
}: let
  cfg = config.system.japanese;
in {
  options.system.japanese = {
    enable = lib.mkEnableOption "enables japanese tools";
  };

  config = lib.mkIf cfg.enable {

    # japanese input
    i18n.inputMethod = {
      enabled = "fcitx5";
  
      fcitx5.addons = with pkgs; [
        fcitx5-mozc
        fcitx5-gtk
        fcitx5-qt
      ];
    };
  
    environment.systemPackages = with pkgs; [
      fcitx5
      fcitx5-configtool
    ];

    # fonts for japanese
    fonts = {
      enableDefaultPackages = true;
      packages = with pkgs; [
        noto-fonts
        noto-fonts-cjk
        noto-fonts-emoji
        source-han-sans
        source-han-serif
      ];
  
      fontconfig = {
        defaultFonts = {
          serif = [ "Noto Serif CJK JP" ];
          sansSerif = [ "Noto Sans CJK JP" ];
          monospace = [ "Noto Sans Mono CJK JP" ];
        };
      };
    };
  };
}
