How to add an ibus engine into to NixOS

I want to add ibus-bamboo engine at GitHub - BambooEngine/ibus-bamboo: Bộ gõ tiếng Việt cho Linux as an ibus input method engine in NixOS. I have created ibus-bamboo.nix as following:

{ fetchFromGitHub, stdenv, go, xorg, gnused }:
stdenv.mkDerivation rec {
  pname = "ibus-bamboo";
  version = "v0.6.5";

  src = fetchFromGitHub {
    owner = "BambooEngine";
    repo = "ibus-bamboo";
    rev = "3f4c148228c239c80d787cca207604f6acd95660";
    sha256= "00fs9mlcvyrybm356q7yl5g2s03j6drsgc82qkx5hx73i56pyd0j";

  buildInputs = [ go xorg.libX11 xorg.libXtst xorg.libXi ];

  patchPhase = "sed -i 's|PREFIX=/usr|PREFIX=|' Makefile && cat Makefile";
  buildPhase = "GOCACHE=/tmp/gocache make build";
  installPhase = "DESTDIR=$out GOCACHE=/tmp/gocache make install";
  fixupPhase = ''
    sed -i "s|/usr/lib/ibus-engine-bamboo|$out/lib/ibus-engine-bamboo|" $out/share/ibus/component/bamboo.xml
    sed -i "s|/usr/share/ibus-bamboo|$out/share/ibus-bamboo|" $out/share/ibus/component/bamboo.xml

  meta = with stdenv.lib; {
    isIbusEngine = true;
    description = "IBus interface to the vietnamese input method";
    homepage = "";
    license = licenses.gpl2Plus;
    platforms = platforms.linux;

and have these lines in in configuration.nix:

{ config, lib, pkgs, ... }:
  myPkgOverlay = self: super: {
    bamboo = pkgs.callPackage ./ibus-bamboo.nix {};
  nixpkgs.overlays = [ myPkgOverlay ];
  i18n.inputMethod = {
    enabled = "ibus";
    ibus.engines = with pkgs; [ ibus-engines.m17n bamboo ];

After run nixos-rebuild switch and reboot the machine, I found ibus bamboo installed into /nix/store/r8h14gqhxn1qqvp05j2v4z957g36vlk0-ibus-bamboo-v0.6.5 and I also found m17n in ibus list-engine output, but ibus-bamboo does not appear in the list. What did I do wrong?

update 1: un-comment buildPhase and installPhase, so that the package can be build and install
update 2: update src to latest package and patch Makefile install prefix. ibus-bambo now appear in /run/current-system/sw/share/ibus but not in ibus list-engine
update 3: fixup exec path and icon path in share/ibus/component/bamboo.xml


I would say the issue is that the derivation does not actually install any files:

$ nix-build -I "nixpkgs=channel:nixos-unstable" -E 'with import <nixpkgs> {}; callPackage ./ibus-bamboo.nix {}'
$ exa -T result/

Not really familiar with Go packaging but perhaps you need buildGoModule or buildGoPackage.

Sorry for late reply. I’m not familiar with Go neither. I have removed comment before buildPhase and installPhase in the script so that it can build succesfully.

I found the solution, just update the exec path in share/ibus/component/bamboo.xml to the path of ibus-bamboo derivation in /nix/store, and the name of the engine is Bamboo, not bamboo.