Rofi-calc not working with rofi-wayland

I am finally getting around to fixing an anoyance I’ve had.

I am running hyprland and for the longest time I was using rofi-calc. My setup is:

programs.rofi = {
    enable = true;
    package = pkgs.rofi-wayland;
    plugins = [
        pkgs.rofi-calc
    ];

Now when I run rofi -show calc -modi calc -no-show-match -no-sort, I get the error Mode calc is not found.

I am sure this worked for a long time with my setup. What has changed? What is the proper way to get rofi-calc working using home-manager?

1 Like

This problem seems like it’s been around for awhile. When I run rofi with a similar setup as above I get on stderr:

(process:2813): Rofi-WARNING **: 16:21:21.037: ABI version of plugin: 'calc.so' does not match: 00000006 expecting: 00000007

I’ve found this open issue at nixpkgs and some other other mentions of this problem, suggesting the application of an overlay which ensures that rofi plugins are compiled against rofi-wayland headers. I can’t however seem to get this working as with the following home-manager module:

{ inputs, pkgs, ... }:

{
	programs.rofi = {
		enable = true;
		package = pkgs.rofi-wayland;
		plugins = with pkgs; [
			rofi-calc
		];
	};
	nixpkgs.overlays = [
		(final: prev: {
			rofi-calc = prev.rofi-calc.override {
				rofi-unwrapped = prev.rofi-wayland-unwrapped;
			};
		})
	];
}

I get the same error.

Just after writing the above, I’ve discovered that this works:

{ inputs, pkgs, ... }:
 
{
	programs.rofi = {
		enable = true;
		package = pkgs.rofi-wayland;
		plugins = with pkgs; [
			(rofi-calc.override { rofi-unwrapped = rofi-wayland-unwrapped; })
		];
	};
}

The problem I guess was some pedantic syntax issue with how nixpkgs overlays are defined within home manager modules.

Not really, but yeah, you don’t need an overlay for this since you can override in situ. Overlays are for replacing all instances of a package within a given nixpkgs instance, it’d make more sense for a library than a leaf package.

Most likely the actual cause was using HM as a NixOS module + useGlobalPkgs = true which nullifies all the nixpkgs.* options in home-manager. Hence any overlays have to be put into the NixOS config rather than the HM one.

That is indeed the case, thanks for taking a load off my mind. Not to dwell on this but what I’m hearing is that it ultimately did come down to an eye-rolling gotcha.

Actually an overlay might be nicer here in the sense that I have no need of the legacy rofi package anywhere in my system and finding out exactly where to replace it for plugins can be a bit of a pain. The option of which rofi binary to compile against is possibly different (e.g. it could be rofi or rofi-unwrapped as above) for each plugin, so when adding a new one you have to read through mostly non-existent documentation or hunt for code snippets on github or leaf through the nixpkgs source to divine what it is. This is just the nix experience at this point and I guess for the moment, easier than studying arcane stuff like overlays in HM.