diff --git a/nixos/configurations/Tytonidae/default.nix b/nixos/configurations/Tytonidae/default.nix index 91d2081..b24209a 100644 --- a/nixos/configurations/Tytonidae/default.nix +++ b/nixos/configurations/Tytonidae/default.nix @@ -5,7 +5,6 @@ nixos-hardware.nixosModules.asus-fx506hm ]) ++ [ - ./i18n.nix ./gui.nix ./users ./kvm.nix @@ -22,6 +21,7 @@ unixName = "david"; hostName = "Tytonidae"; }; + i18n.enable = true; programs = { dae.enable = true; openssh.enable = true; diff --git a/nixos/configurations/Tytonidae/i18n.nix b/nixos/configurations/Tytonidae/i18n.nix deleted file mode 100644 index 9f8576a..0000000 --- a/nixos/configurations/Tytonidae/i18n.nix +++ /dev/null @@ -1,43 +0,0 @@ -{ - pkgs, - outputs, - ... -}: -{ - i18n = { - defaultLocale = "C.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "zh_CN.UTF-8"; - LC_IDENTIFICATION = "zh_CN.UTF-8"; - LC_MEASUREMENT = "zh_CN.UTF-8"; - LC_MONETARY = "zh_CN.UTF-8"; - LC_NAME = "zh_CN.UTF-8"; - LC_NUMERIC = "zh_CN.UTF-8"; - LC_PAPER = "zh_CN.UTF-8"; - LC_TELEPHONE = "zh_CN.UTF-8"; - LC_TIME = "zh_CN.UTF-8"; - }; - inputMethod = { - enable = true; - type = "fcitx5"; - fcitx5 = { - addons = with pkgs; [ - libsForQt5.fcitx5-qt - fcitx5-gtk - fcitx5-configtool - fcitx5-chinese-addons - (fcitx5-rime.override { - rimeDataPkgs = ( - with (outputs.packages."${pkgs.system}"); - [ - rime-ice - ] - ); - }) - ]; - waylandFrontend = true; - }; - }; - }; - -} diff --git a/nixos/modules/i18n.nix b/nixos/modules/i18n.nix new file mode 100644 index 0000000..e0de268 --- /dev/null +++ b/nixos/modules/i18n.nix @@ -0,0 +1,54 @@ +{ + pkgs, + outputs, + lib, + config, + ... +}: +let + cfg = config.youthlic.i18n; +in +{ + options = { + youthlic.i18n = { + enable = lib.mkEnableOption "zh env"; + }; + }; + config = lib.mkIf cfg.enable { + i18n = { + defaultLocale = "C.UTF-8"; + extraLocaleSettings = { + LC_ADDRESS = "zh_CN.UTF-8"; + LC_IDENTIFICATION = "zh_CN.UTF-8"; + LC_MEASUREMENT = "zh_CN.UTF-8"; + LC_MONETARY = "zh_CN.UTF-8"; + LC_NAME = "zh_CN.UTF-8"; + LC_NUMERIC = "zh_CN.UTF-8"; + LC_PAPER = "zh_CN.UTF-8"; + LC_TELEPHONE = "zh_CN.UTF-8"; + LC_TIME = "zh_CN.UTF-8"; + }; + inputMethod = { + enable = true; + type = "fcitx5"; + fcitx5 = { + addons = with pkgs; [ + libsForQt5.fcitx5-qt + fcitx5-gtk + fcitx5-configtool + fcitx5-chinese-addons + (fcitx5-rime.override { + rimeDataPkgs = ( + with (outputs.packages."${pkgs.system}"); + [ + rime-ice + ] + ); + }) + ]; + waylandFrontend = true; + }; + }; + }; + }; +}