Roundcube with plugins

Hi everyone. I’m looking to migrate my couple of years old roundcube setup to NixOS. I’ve managed to import and upgrade the database but what I’m stuck on is: modules. On my old Roundcube setup I had a lot of those and I’m not certain how to get this done on NixOS.

We have services.roundcube.plugins with the description:

List of roundcube plugins to enable. Currently, only those directly shipped with Roundcube are supported.

There also is services.roundcube.package with the following description:

The package which contains roundcube’s sources. Can be overriden to create an environment which contains roundcube and third-party plugins.

Type: package
Default: pkgs.roundcube
Example: roundcube.withPlugins (plugins: [ plugins.persistent_login ])

Honestly I have no idea how to get started with this. One of the useful plugins my old setup is using is the right click context menu and yet another one is the twofactor gauthenticator plugin.

How can I include these plugins into my roundcube setup? Where do I start?

I’m not roundcube user, but from documentation I can say:

Good news and bad news:
Context menu is already packed, this should give you a basic

{pkgs, ...}:
  services.roundcube.enable  = true;
  services.roundcube.plugins = [ "contextmenu" ];
  services.roundcube.package = pkgs.roundcube.withPlugins (
    plugins: [ plugins.contextmenu ]

You can search for already packed plugins in

Two factor isn’t packed yet, that means you have to create a package like someone did for contextmenu and others

If other plugins are simple like contextmenu or custom_from whould be like this:

{pkgs, ...}:
let custom_from = pkgs.roundcubePlugin rec {
  pname   = "custom_from";
  version = "1.6.6";
  src     = pkgs.fetchzip {
    url  = "${version}.zip";
    hash = "sha256-QvMYwFWY0BZOkzhDtW7XJ77i5mVkDNAiN4JBdsCuUy0=";
  services.roundcube.enable  = true;
  services.roundcube.plugins = [ "contextmenu" "custom_from"];
  services.roundcube.package = pkgs.roundcube.withPlugins (
    plugins: [ plugins.contextmenu custom_from ]
1 Like

Hi @hugosenari thanks for your suggestions. I finally got around to testing this.

I tried your example but it told me that pkgs.roundcubePlugin doesn’t exist, so I assumed you meant pkgs.roundcubePlugins, but when using that I am getting the following error:

building the system configuration...
warning: Git tree '/home/markvd/user/mozart' is dirty
error: attempt to call something which is not a function but a set

       at /nix/store/i5z77x6xa1n77zi07jxdd93v1jxlr5c6-source/nixos/service/roundcube.nix:5:19:

            4|   let
            5|     custom_from = pkgs.roundcubePlugins rec {
             |                   ^
            6|       pname   = "custom_from";
(use '--show-trace' to show detailed location information)

Any idea how I should handle this?
EDIT: I figured out that it works when I use pkgs.roundcubePlugins.roundcubePlugin. With that, this works very well. Much thanks! :smiley_cat:

Roundcube maintainer here. It’s pkgs.roundcubePlugins.roundcubePlugin. Does that fix your issue? %)


Hi @Ma27 yess I just found it with some help in the repl (the tab key, specifically :laughing:)

Much thanks, it works now :slightly_smiling_face: :+1:


Please PR your plugins pkgs to nixpkgs :wink:

1 Like

Ok! Will do. No problem.