From 4fb2ac3db02e8380c5e5752c8751efab8a5362c5 Mon Sep 17 00:00:00 2001 From: Shogo Takata Date: Sun, 26 Jul 2026 16:41:11 +0900 Subject: [PATCH] ibus-mozc: init at 3.35.6354 Split the IBus engine and renderer from the Mozc server package, retain the existing ibus-engines aliases, and install all runtime icons referenced by the engine. Assisted-by: pi (OpenAI GPT-5.6-sol) --- doc/release-notes/rl-2611.section.md | 2 + pkgs/by-name/ib/ibus-mozc/package.nix | 136 ++++++++++++++++++ pkgs/by-name/ib/ibus-mozc/renderer-path.patch | 21 +++ pkgs/by-name/mo/mozc-ut/package.nix | 2 - pkgs/by-name/mo/mozc/package.nix | 59 ++------ pkgs/top-level/all-packages.nix | 4 +- 6 files changed, 169 insertions(+), 55 deletions(-) create mode 100644 pkgs/by-name/ib/ibus-mozc/package.nix create mode 100644 pkgs/by-name/ib/ibus-mozc/renderer-path.patch diff --git a/doc/release-notes/rl-2611.section.md b/doc/release-notes/rl-2611.section.md index 4cb16cd654be..3b3e994ec656 100644 --- a/doc/release-notes/rl-2611.section.md +++ b/doc/release-notes/rl-2611.section.md @@ -368,6 +368,8 @@ - All databases of the MySQL family – `mysql`, `mariadb` and `percona` – now provide a client-only package `client` sub-attribute. Use the `.client` package if the server components are not needed. The main package continues to ship the client binaries as well. +- `mozc` has been split into `mozc`, `ibus-mozc` and `emacs-mozc`. The `ibus-mozc` package replaces the previous `ibus-engines.mozc` alias. + - Package-URL (PURL, https://github.com/package-url/purl-spec) metadata identifier has been added for `fetchgit`, `fetchpypi`, `fetchFromGithub` fetchers and to `buildPerlPackage`. `mkDerivation` has been adjusted to reuse this information. Package-URLs allow reliably identifying and locating software packages. diff --git a/pkgs/by-name/ib/ibus-mozc/package.nix b/pkgs/by-name/ib/ibus-mozc/package.nix new file mode 100644 index 000000000000..f610eef964d4 --- /dev/null +++ b/pkgs/by-name/ib/ibus-mozc/package.nix @@ -0,0 +1,136 @@ +{ + lib, + qt6, + pkg-config, + ibus, + unzip, + python3, + libglvnd, + glib, + stdenv, + writableTmpDirAsHomeHook, + makeDesktopItem, + copyDesktopItems, + mozc, +}: +let + pname = "ibus-mozc"; + inherit (mozc) + version + src + bazel + bazelCommonArgs + vendorDeps + setupBazelVendor + ; + + nativeBuildInputs = [ + bazel + copyDesktopItems + pkg-config + python3 + qt6.wrapQtAppsHook + unzip + writableTmpDirAsHomeHook + ]; + + buildInputs = [ + glib + ibus + libglvnd + qt6.qtbase + ]; + + includePath = lib.makeIncludePath buildInputs; + libraryPath = lib.makeLibraryPath buildInputs; + + bazelArgs = bazelCommonArgs ++ [ + "--action_env=C_INCLUDE_PATH=${includePath}" + "--action_env=CPLUS_INCLUDE_PATH=${includePath}" + "--action_env=LIBRARY_PATH=${libraryPath}" + "renderer/qt:mozc_renderer" + "unix/ibus:ibus_mozc" + ]; +in +stdenv.mkDerivation { + inherit + pname + version + src + nativeBuildInputs + buildInputs + ; + + strictDeps = true; + __structuredAttrs = true; + + patches = [ ./renderer-path.patch ]; + + env.USE_BAZEL_VERSION = bazel.version; + # Work around Bazel's username lookup with sandbox=false and auto-allocate-uids=true. + env.USER = "nixbld"; + + postPatch = '' + cd src + + ${setupBazelVendor vendorDeps} + + substituteInPlace config.bzl \ + --replace-fail "/usr/lib/mozc" "${mozc}/lib/mozc" \ + --replace-fail "/usr" "$out" + + # Server and tools live in mozc, but the candidate renderer lives here. + substituteInPlace base/system_util.cc \ + --subst-var-by renderer_dir "$out/lib/mozc" + ''; + + buildPhase = '' + runHook preBuild + + bazel build --lockfile_mode=error --vendor_dir=vendor_dir ${lib.escapeShellArgs bazelArgs} + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -Dm555 bazel-bin/renderer/qt/mozc_renderer "$out/lib/mozc/mozc_renderer" + install -Dm555 bazel-bin/unix/ibus/ibus_mozc "$out/lib/ibus-mozc/ibus-engine-mozc" + install -Dm555 bazel-bin/unix/ibus/mozc.xml "$out/share/ibus/component/mozc.xml" + + unzip bazel-bin/unix/icons.zip -d "$out/share/ibus-mozc/" + install -Dm444 data/images/product_icon_32bpp-128.png "$out/share/ibus-mozc/product_icon.png" + install -Dm444 data/images/icon.svg "$out/share/ibus-mozc/product_icon.svg" + install -Dm444 ../LICENSE "$out/share/licenses/$pname/LICENSE" + + runHook postInstall + ''; + + # create a desktop file for gnome-control-center + # contents copied from ubuntu + desktopItems = [ + (makeDesktopItem { + name = "ibus-setup-mozc-jp"; + desktopName = "Mozc Setup"; + exec = "${mozc}/lib/mozc/mozc_tool --mode=config_dialog"; + type = "Application"; + startupNotify = true; + noDisplay = true; + }) + ]; + + passthru = { + inherit vendorDeps; + }; + meta = { + isIbusEngine = true; + description = "Japanese input method from Google"; + homepage = "https://github.com/google/mozc"; + license = lib.licenses.free; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ + pineapplehunter + ]; + }; +} diff --git a/pkgs/by-name/ib/ibus-mozc/renderer-path.patch b/pkgs/by-name/ib/ibus-mozc/renderer-path.patch new file mode 100644 index 000000000000..5159ecf319de --- /dev/null +++ b/pkgs/by-name/ib/ibus-mozc/renderer-path.patch @@ -0,0 +1,21 @@ +--- a/src/base/system_util.cc ++++ b/src/base/system_util.cc +@@ -356,7 +356,7 @@ std::string SystemUtil::GetRendererPath() { + if (server_path.empty()) { + return ""; + } +- return FileUtil::JoinPath(server_path, kMozcRenderer); ++ return FileUtil::JoinPath("@renderer_dir@", kMozcRenderer); + } + + std::string SystemUtil::GetToolPath() { +--- a/src/unix/ibus/mozc_engine.cc ++++ b/src/unix/ibus/mozc_engine.cc +@@ -216,6 +216,5 @@ bool UseMozcCandidateWindow(const IbusConfig& ibus_config) { +- const std::string renderer_path = +- FileUtil::JoinPath(SystemUtil::GetServerDirectory(), "mozc_renderer"); ++ const std::string renderer_path = SystemUtil::GetRendererPath(); + if (absl::Status s = FileUtil::FileExists(renderer_path); !s.ok()) { + LOG(ERROR) << s; + return false; + } diff --git a/pkgs/by-name/mo/mozc-ut/package.nix b/pkgs/by-name/mo/mozc-ut/package.nix index fca5b658ebbf..a758f1e8d622 100644 --- a/pkgs/by-name/mo/mozc-ut/package.nix +++ b/pkgs/by-name/mo/mozc-ut/package.nix @@ -8,10 +8,8 @@ mozcdic-ut-place-names, mozcdic-ut-skk-jisyo, mozcdic-ut-sudachidict, - withIbus ? false, }: mozc.override { - inherit withIbus; dictionaries = [ mozcdic-ut-alt-cannadic mozcdic-ut-edict2 diff --git a/pkgs/by-name/mo/mozc/package.nix b/pkgs/by-name/mo/mozc/package.nix index 1623676c747c..be09f12db089 100644 --- a/pkgs/by-name/mo/mozc/package.nix +++ b/pkgs/by-name/mo/mozc/package.nix @@ -6,16 +6,11 @@ bazel_9, glib, ibus, - unzip, xdg-utils, python3, libglvnd, stdenv, writableTmpDirAsHomeHook, - makeDesktopItem, - copyDesktopItems, - - withIbus ? false, dictionaries ? [ ], merge-ut-dictionaries, @@ -25,7 +20,7 @@ let ut-dictionary = merge-ut-dictionaries.override { inherit dictionaries; }; - pname = "mozc"; + pname = "mozc-server"; version = "3.35.6354"; src = fetchFromGitHub { @@ -38,17 +33,13 @@ let nativeBuildInputs = [ bazel - copyDesktopItems pkg-config python3 qt6.wrapQtAppsHook - unzip writableTmpDirAsHomeHook ]; buildInputs = [ - glib - ibus libglvnd qt6.qtbase ]; @@ -64,19 +55,13 @@ let "--@com_google_protobuf//bazel/flags:prefer_prebuilt_protoc=false" ]; - bazelArgs = - bazelCommonArgs - ++ [ - "--action_env=C_INCLUDE_PATH=${includePath}" - "--action_env=CPLUS_INCLUDE_PATH=${includePath}" - "--action_env=LIBRARY_PATH=${libraryPath}" - "gui/tool:mozc_tool" - "server:mozc_server" - ] - ++ lib.optionals withIbus [ - "renderer/qt:mozc_renderer" - "unix/ibus:ibus_mozc" - ]; + bazelArgs = bazelCommonArgs ++ [ + "--action_env=C_INCLUDE_PATH=${includePath}" + "--action_env=CPLUS_INCLUDE_PATH=${includePath}" + "--action_env=LIBRARY_PATH=${libraryPath}" + "gui/tool:mozc_tool" + "server:mozc_server" + ]; bazelPythonConfig = '' local_runtime_repo = use_repo_rule( @@ -247,38 +232,11 @@ stdenv.mkDerivation { install -Dm555 bazel-bin/server/mozc_server "$out/lib/mozc/mozc_server" install -Dm555 bazel-bin/gui/tool/mozc_tool "$out/lib/mozc/mozc_tool" - '' - + lib.optionalString withIbus '' - install -Dm555 bazel-bin/renderer/qt/mozc_renderer "$out/lib/mozc/mozc_renderer" - install -Dm555 bazel-bin/unix/ibus/ibus_mozc "$out/lib/ibus-mozc/ibus-engine-mozc" - install -Dm555 bazel-bin/unix/ibus/mozc.xml "$out/share/ibus/component/mozc.xml" - - unzip bazel-bin/unix/icons.zip -d "$out/share/ibus-mozc/" - install -Dm444 data/images/product_icon_32bpp-128.png "$out/share/ibus-mozc/product_icon.png" - install -Dm444 data/images/icon.svg "$out/share/ibus-mozc/product_icon.svg" - '' - + '' install -Dm444 ../LICENSE "$out/share/licenses/$pname/LICENSE" runHook postInstall ''; - desktopItems = lib.optionals withIbus [ - (makeDesktopItem { - name = "ibus-setup-mozc-jp"; - desktopName = "Mozc Setup"; - exec = "@out@/lib/mozc/mozc_tool --mode=config_dialog"; - type = "Application"; - startupNotify = true; - noDisplay = true; - }) - ]; - - postFixup = lib.optionalString withIbus '' - substituteInPlace "$out/share/applications/ibus-setup-mozc-jp.desktop" \ - --subst-var out - ''; - passthru = { inherit vendorDeps @@ -289,7 +247,6 @@ stdenv.mkDerivation { ; }; meta = { - isIbusEngine = withIbus; description = "Japanese input method from Google"; homepage = "https://github.com/google/mozc"; changelog = "https://github.com/google/mozc/releases/tag/${version}"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 34308e903993..1f7f174ff014 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1752,8 +1752,8 @@ with pkgs; m17n = callPackage ../tools/inputmethods/ibus-engines/ibus-m17n { }; - mozc = mozc.override { withIbus = true; }; - mozc-ut = mozc-ut.override { withIbus = true; }; + mozc = ibus-mozc; + mozc-ut = ibus-mozc.override { mozc = mozc-ut; }; pinyin = callPackage ../tools/inputmethods/ibus-engines/ibus-pinyin { };