2022-12-10 10:47:34 +00:00
|
|
|
# System-wide i18n options. This is primarily used for desktop installations.
|
|
|
|
# Unless there is really good reasons for setting i18n options on the server,
|
|
|
|
# this module will stay aiming for desktop.
|
2023-10-02 06:26:11 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2022-07-13 23:58:39 +00:00
|
|
|
|
|
|
|
let
|
2024-01-22 06:48:55 +00:00
|
|
|
cfg = config.suites.i18n;
|
2022-09-12 10:51:09 +00:00
|
|
|
in
|
|
|
|
{
|
2024-01-22 06:48:55 +00:00
|
|
|
options.suites.i18n = {
|
2022-10-10 03:45:22 +00:00
|
|
|
enable = lib.mkEnableOption "main i18n config";
|
2023-12-13 03:24:04 +00:00
|
|
|
setup = lib.mkOption {
|
2024-06-26 04:31:33 +00:00
|
|
|
type = with lib.types; nullOr (enum [ "fcitx5" "ibus" ]);
|
2023-12-13 03:24:04 +00:00
|
|
|
description = ''
|
|
|
|
The primary input method engine to be used and its related
|
|
|
|
configuration and setup.
|
|
|
|
'';
|
2024-06-26 04:31:33 +00:00
|
|
|
default = null;
|
2023-12-13 03:24:04 +00:00
|
|
|
example = "ibus";
|
|
|
|
};
|
2022-07-13 23:58:39 +00:00
|
|
|
};
|
2022-09-12 10:51:09 +00:00
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
|
|
|
{
|
2022-11-29 13:07:05 +00:00
|
|
|
# I don't speak all of the languages. It's just nice to have some
|
2022-09-12 10:51:09 +00:00
|
|
|
# additional language packs for it. ;p
|
2022-11-29 13:07:05 +00:00
|
|
|
i18n.supportedLocales = lib.mkForce [ "all" ];
|
2022-09-12 10:51:09 +00:00
|
|
|
|
|
|
|
# The most minimal set of packages for most locales.
|
2023-07-29 05:21:20 +00:00
|
|
|
fonts.packages = with pkgs; [
|
2022-09-12 10:51:09 +00:00
|
|
|
noto-fonts
|
|
|
|
noto-fonts-cjk
|
|
|
|
noto-fonts-cjk-sans
|
|
|
|
noto-fonts-cjk-serif
|
2023-11-12 02:50:32 +00:00
|
|
|
noto-fonts-lgc-plus
|
|
|
|
noto-fonts-extra
|
|
|
|
noto-fonts-emoji
|
|
|
|
noto-fonts-emoji-blob-bin
|
2022-09-12 10:51:09 +00:00
|
|
|
|
|
|
|
source-code-pro
|
|
|
|
source-sans-pro
|
|
|
|
source-han-sans
|
|
|
|
source-serif-pro
|
|
|
|
source-han-serif
|
|
|
|
source-han-mono
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2023-12-13 03:24:04 +00:00
|
|
|
(lib.mkIf (cfg.setup == "ibus") {
|
2022-09-12 10:51:09 +00:00
|
|
|
i18n.inputMethod = {
|
|
|
|
enabled = "ibus";
|
|
|
|
ibus.engines = with pkgs.ibus-engines; [
|
|
|
|
mozc
|
|
|
|
rime
|
|
|
|
hangul
|
|
|
|
table
|
|
|
|
table-others
|
|
|
|
typing-booster
|
|
|
|
uniemoji
|
|
|
|
];
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
2023-12-13 03:24:04 +00:00
|
|
|
(lib.mkIf (cfg.setup == "fcitx5") {
|
2022-09-12 10:51:09 +00:00
|
|
|
i18n.inputMethod = {
|
|
|
|
enabled = "fcitx5";
|
2023-11-13 11:51:50 +00:00
|
|
|
fcitx5.addons = with pkgs; [
|
|
|
|
fcitx5-lua
|
|
|
|
fcitx5-mozc
|
|
|
|
fcitx5-rime
|
|
|
|
fcitx5-table-extra
|
|
|
|
fcitx5-table-other
|
|
|
|
fcitx5-unikey
|
|
|
|
];
|
2022-09-12 10:51:09 +00:00
|
|
|
};
|
|
|
|
})
|
|
|
|
]);
|
2022-07-13 23:58:39 +00:00
|
|
|
}
|