How to create an overlay for a package in a package set?

The issue

Since the update, building kdePackages.fcitx5-qt fails. This issue occurs in the nixos-unstable branch. (If you want to know about this issue, click this and this). fcitx5 can’t be used because of this issue. It has been fixed in the nixpkgs-unstable or master branch (according to this).

So I want to create an overlay for kdePackages.fcitx5-qt but all of my code failed. Here is code I tried:

# overlays.nix
# Note: `pkgs-unstable` has been initialized in my `flake.nix` and has been delivered there. 
{ config, lib, pkgs, pkgs-unstable, ... }:

{
  # use `lib.recursiveUpdate`, no effort
  nixpkgs.overlays = [
    (final: prev: {
      kdePackages = final.lib.recursiveUpdate prev.kdePackages {
        fcitx5-qt = pkgs-unstable.kdePackages.fcitx5-qt;
      };
    })
  ];


  # use `lib.attrsets.recursiveUpdate`, no effort 
  nixpkgs.overlays = [
    (final: prev: {
      kdePackages = final.lib.attrsets.recursiveUpdate prev.kdePackages {
        fcitx5-qt = pkgs-unstable.kdePackages.fcitx5-qt;
      };
    })
  ];

  # use //, no effort 
  nixpkgs.overlays = [
    (final: prev: {
      kdePackages = prev.kdePackages // {
        fcitx5-qt = pkgs-unstable.kdePackages.fcitx5-qt;
      };
    })
  ];

  # this will complain `attribute breeze-icons missing`, won't build.
  nixpkgs.overlays = [
    (final: prev: {
      kdePackages.fcitx5-qt = pkgs-unstable.kdePackages.fcitx5-qt;
    })
  ];
}

Other info:

I use flakes. My inputs looks like this:

    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

And I use home-manager. It has been installed through nixos module. fcitx5 is configured through home-manager options. If there are any necessary details I have not mentioned, let me know.

My labor

I use overlay for the first time. I’ve read wiki page and this guide. And LLM also didn’t give any useful solutions. Code above is not all of my labor. I struggled here one whole day ;-(

I appreciate any help.

It’s a bit awkward. Since I noticed community has merged that pull request to nixos-unstable branch. But I still want to know about title. So I want to keep this post unless I’ve know why my code wouldn’t work.

1 Like

Thank you for your reply. I noticed you created an overlay for qt6Packages to fix this issue. However, I haven’t found a package set named qt6Packages on this search page yet.

My knowledge is still limited, and I’m unsure whether failing to create an overlay for the correct package set is the reason my fix wasn’t working.

I would be most grateful if you could explain how you determined that manipulating qt6Packages would resolve the issue.