Excluding all Akonadi packages on KDE Plasma

I’m confused by the following “knowledge nugget”:

1. Disable Akonadi in System Configuration
If you do not use KDE PIM applications that rely on Akonadi (like KMail, KOrganizer, or KAddressbook), you can prevent the service from starting by setting the configuration option to false in your configuration.nix:

services.accounts-qml-module.enable = false;

Note: In many modern NixOS configurations, Akonadi is pulled in as a dependency by kde-plasma or kde-apps. If you are using the full KDE Plasma desktop, simply disabling the service might not be enough if the desktop environment tries to launch it. The most robust method for a full KDE setup is to disable it per-user or uninstall the packages.

I know it’s a RAM and disk hog and requires MariaDB (also unneeded), and I don’t use any of the builtins such as korganizer and kmail. So I’d like it out of my configuration.nix, but I’m not sure how to do it.

Can anybody point me to how to declaratively make it gone?

1 Like

Another AI search pointed me to this:

environment.plasma6.excludePackages = with pkgs.kdePackages; [
  akonadi
  akonadi-calendar
  akonadi-contacts
  akonadi-mime
  akonadi-search
  akonadiconsole
  akregator
  kalarm
  kaddressbook
  kmail
 #knotes
 #kjots
  korganizer
  kontact
  libkgapi
 #pim-common
  # Add any other specific akonadi-* dependencies you wish to remove
];   

The commented plasma6 packages seemed to be required to run nixos-rebuild.

Then:

2. Disable the Service

If you want to ensure the Akonadi service does not start even if some components remain, disable the accounts QML module service in your configuration:

services.accounts-qml-module.enable = false;

3. Rebuild and Clean Up

After editing configuration.nix, rebuild your system to apply the changes:

sudo nixos-rebuild switch

To remove any previously installed Akonadi packages from your user profile, you can also run:

nix-env --uninstall '*akonadi*' '*kdepim*'

4. Remove Configuration Data (Optional)

To completely remove user-specific Akonadi data, delete the following directories:

rm -rf ~/.config/akonadi
rm -rf ~/.local/share/akonadi

Note: Removing Akonadi may break functionality for KDE PIM applications like KMail, KOrganizer, and KAddressbook. Ensure you do not rely on these features before proceeding.