Skip to content

Commit

Permalink
feat(nixos): add fcitx5 module
Browse files Browse the repository at this point in the history
Co-authored-by: Weathercold <weathercold.scr@proton.me>
Co-authored-by: seth <getchoo@tuta.io>
  • Loading branch information
3 people committed Sep 30, 2024
1 parent 630b559 commit e0bb6ff
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/nixos/all-modules.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
./console.nix
./fcitx5.nix
./globals.nix
./grub.nix
./plymouth.nix
Expand Down
31 changes: 31 additions & 0 deletions modules/nixos/fcitx5.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (config.catppuccin) sources;
cfg = config.i18n.inputMethod.fcitx5.catppuccin;
enable =
cfg.enable
&& (
config.i18n.inputMethod.enable or true
&& config.i18n.inputMethod.type or config.i18n.inputMethod.enabled == "fcitx5"
);

theme = pkgs.runCommand "catppuccin-fcitx5" { } ''
mkdir -p $out/share/fcitx5/themes/
cp -r ${sources.fcitx5}/src/catppuccin-${cfg.flavor}-${cfg.accent}/ $out/share/fcitx5/themes/
'';
in
{
options.i18n.inputMethod.fcitx5.catppuccin = lib.ctp.mkCatppuccinOpt { name = "Fcitx5"; } // {
accent = lib.ctp.mkAccentOpt "Fcitx5";
};

config.i18n.inputMethod.fcitx5 = lib.mkIf enable {
addons = [ theme ];
settings.addons.classicui.globalSection.Theme = "catppuccin-${cfg.flavor}-${cfg.accent}";
};
}
5 changes: 5 additions & 0 deletions tests/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ testers.runNixOSTest {

console.enable = true;

i18n.inputMethod = {
enable = true;
type = "fcitx5";
};

users.users.test = {
isNormalUser = true;
home = "/home/test";
Expand Down

0 comments on commit e0bb6ff

Please sign in to comment.