From 464a162703da08db447c3a0da48382d949380dbc Mon Sep 17 00:00:00 2001 From: imxyy_soope_ Date: Mon, 4 Aug 2025 19:59:56 +0800 Subject: [PATCH] feat: rework fcitx5 overlay, avoid rebuild --- modules/i18n/fcitx5.nix | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/modules/i18n/fcitx5.nix b/modules/i18n/fcitx5.nix index a295d18..50975fa 100644 --- a/modules/i18n/fcitx5.nix +++ b/modules/i18n/fcitx5.nix @@ -18,7 +18,6 @@ lib.my.makeSwitch { fcitx5 = { addons = with pkgs; [ fcitx5-chinese-addons # fcitx5-mozc - fluent-fcitx5 fcitx5-lightly ]; waylandFrontend = true; @@ -105,16 +104,39 @@ lib.my.makeSwitch { nixpkgs.overlays = [ ( final: prev: - lib.infuse prev ( - lib.genAttrs + lib.mergeAttrsList ( + map + ( + { pkg, exe }: + { + + ${pkg} = final.stdenvNoCC.mkDerivation { + pname = prev.${pkg}.pname; + version = prev.${pkg}.version; + src = prev.${pkg}; + nativeBuildInputs = [ final.makeWrapper ]; + installPhase = '' + cp -r . $out + mv $out/bin/${exe} $out/bin/.${exe}-old + makeWrapper $out/bin/.${exe}-old $out/bin/${exe} --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--wayland-text-input-version=3}}" + ''; + }; + } + ) [ - "qq" - "vscodium" - "signal-desktop" + { + pkg = "qq"; + exe = "qq"; + } + { + pkg = "vscodium"; + exe = "codium"; + } + { + pkg = "signal-desktop"; + exe = "signal-desktop"; + } ] - (_: { - __input.commandLineArgs.__append = "--wayland-text-input-version=3"; - }) ) ) (