mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 12:19:07 +00:00
profiles/i18n: modularize common config into separate options
This commit is contained in:
parent
b95f6d7fd2
commit
39e11eac71
@ -3,41 +3,88 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.profiles.i18n;
|
cfg = config.profiles.i18n;
|
||||||
in {
|
in
|
||||||
options.profiles.i18n.enable = lib.mkEnableOption "i18n-related options";
|
{
|
||||||
|
options.profiles.i18n = {
|
||||||
config = lib.mkIf cfg.enable {
|
enable = lib.mkEnableOption "i18n-related options";
|
||||||
# I don't speak all of the listed languages. It's just nice to have some
|
ibus.enable = lib.mkEnableOption "i18n config with ibus";
|
||||||
# additional language packs for it. ;p
|
fcitx5.enable = lib.mkEnableOption "i18n config with fcitx5";
|
||||||
i18n.supportedLocales = [
|
|
||||||
"en_US.UTF-8/UTF-8"
|
|
||||||
"ja_JP.UTF-8/UTF-8"
|
|
||||||
"ko_KR.UTF-8/UTF-8"
|
|
||||||
"zh_CN.UTF-8/UTF-8"
|
|
||||||
"zh_HK.UTF-8/UTF-8"
|
|
||||||
"zh_SG.UTF-8/UTF-8"
|
|
||||||
"tl_PH.UTF-8/UTF-8"
|
|
||||||
"fr_FR.UTF-8/UTF-8"
|
|
||||||
"it_IT.UTF-8/UTF-8"
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
goldendict
|
|
||||||
];
|
|
||||||
|
|
||||||
# The most minimal set of packages for most locales.
|
|
||||||
fonts.fonts = with pkgs; [
|
|
||||||
noto-fonts
|
|
||||||
noto-fonts-cjk
|
|
||||||
noto-fonts-cjk-sans
|
|
||||||
noto-fonts-cjk-serif
|
|
||||||
|
|
||||||
source-code-pro
|
|
||||||
source-sans-pro
|
|
||||||
source-han-sans
|
|
||||||
source-serif-pro
|
|
||||||
source-han-serif
|
|
||||||
source-han-mono
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||||
|
{
|
||||||
|
assertions = let enabledi18nConfigs = lib.countAttrs (_: setup: lib.isAttrs setup && setup.enable) cfg; in
|
||||||
|
[{
|
||||||
|
assertion = enabledi18nConfigs < 1;
|
||||||
|
message = ''
|
||||||
|
Only one i18n setup should be enabled at any given time.
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
|
||||||
|
# I don't speak all of the listed languages. It's just nice to have some
|
||||||
|
# additional language packs for it. ;p
|
||||||
|
i18n.supportedLocales = lib.mkBefore [
|
||||||
|
"en_US.UTF-8/UTF-8"
|
||||||
|
"ja_JP.UTF-8/UTF-8"
|
||||||
|
"ko_KR.UTF-8/UTF-8"
|
||||||
|
"zh_CN.UTF-8/UTF-8"
|
||||||
|
"zh_HK.UTF-8/UTF-8"
|
||||||
|
"zh_SG.UTF-8/UTF-8"
|
||||||
|
"tl_PH.UTF-8/UTF-8"
|
||||||
|
"fr_FR.UTF-8/UTF-8"
|
||||||
|
"it_IT.UTF-8/UTF-8"
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
goldendict
|
||||||
|
];
|
||||||
|
|
||||||
|
# The most minimal set of packages for most locales.
|
||||||
|
fonts.fonts = with pkgs; [
|
||||||
|
noto-fonts
|
||||||
|
noto-fonts-cjk
|
||||||
|
noto-fonts-cjk-sans
|
||||||
|
noto-fonts-cjk-serif
|
||||||
|
|
||||||
|
source-code-pro
|
||||||
|
source-sans-pro
|
||||||
|
source-han-sans
|
||||||
|
source-serif-pro
|
||||||
|
source-han-serif
|
||||||
|
source-han-mono
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
(lib.mkIf cfg.ibus.enable {
|
||||||
|
i18n.inputMethod = {
|
||||||
|
enabled = "ibus";
|
||||||
|
ibus.engines = with pkgs.ibus-engines; [
|
||||||
|
mozc
|
||||||
|
rime
|
||||||
|
hangul
|
||||||
|
table
|
||||||
|
table-others
|
||||||
|
typing-booster
|
||||||
|
uniemoji
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(lib.mkIf cfg.fcitx5.enable {
|
||||||
|
i18n.inputMethod = {
|
||||||
|
enabled = "fcitx5";
|
||||||
|
fcitx5 = {
|
||||||
|
enableRimeData = true;
|
||||||
|
addons = with pkgs; [
|
||||||
|
fcitx5-lua
|
||||||
|
fcitx5-mozc
|
||||||
|
fcitx5-rime
|
||||||
|
fcitx5-table-extra
|
||||||
|
fcitx5-table-other
|
||||||
|
fcitx5-unikey
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
@ -110,18 +110,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.packagekit.enable = false;
|
services.packagekit.enable = false;
|
||||||
|
profiles.i18n = {
|
||||||
i18n.inputMethod = {
|
enable = true;
|
||||||
enabled = "ibus";
|
ibus.enable = true;
|
||||||
ibus.engines = with pkgs.ibus-engines; [
|
|
||||||
mozc
|
|
||||||
rime
|
|
||||||
hangul
|
|
||||||
table
|
|
||||||
table-others
|
|
||||||
typing-booster
|
|
||||||
uniemoji
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Since we're using KDE Connect, we'll have to use gsconnect.
|
# Since we're using KDE Connect, we'll have to use gsconnect.
|
||||||
|
Loading…
Reference in New Issue
Block a user