anchor.diff:        environment.systemPackages =
           with libsForQt5;
           with plasma5; with kdeGear; with kdeFrameworks;
  -        [
  -          frameworkintegration
  -          kactivities
  -          kauth
  -          kcmutils
  -          kconfig
  -          kconfigwidgets
  -          kcoreaddons
  -          kdoctools
  -          kdbusaddons
  -          kdeclarative
  -          kded
  -          kdesu
  -          kdnssd
  -          kemoticons
  -          kfilemetadata
  -          kglobalaccel
  -          kguiaddons
  -          kiconthemes
  -          kidletime
  -          kimageformats
  -          kinit
  -          kirigami2 # In system profile for SDDM theme. TODO: wrapper.
  -          kio
  -          kjobwidgets
  -          knewstuff
  -          knotifications
  -          knotifyconfig
  -          kpackage
  -          kparts
  -          kpeople
  -          krunner
  -          kservice
  -          ktextwidgets
  -          kwallet
  -          kwallet-pam
  -          kwalletmanager
  -          kwayland
  -          kwayland-integration
  -          kwidgetsaddons
  -          kxmlgui
  -          kxmlrpcclient
  -          plasma-framework
  -          solid
  -          sonnet
  -          threadweaver
  -
  -          breeze-qt5
  -          kactivitymanagerd
  -          kde-cli-tools
  -          kdecoration
  -          kdeplasma-addons
  -          kgamma5
  -          khotkeys
  -          kscreen
  -          kscreenlocker
  -          kwayland
  -          kwin
  -          kwrited
  -          libkscreen
  -          libksysguard
  -          milou
  -          plasma-browser-integration
  -          plasma-integration
  -          polkit-kde-agent
  -
  -          plasma-desktop
  -          plasma-workspace
  -          plasma-workspace-wallpapers
  -
  -          konsole
  -          oxygen
  -
  -          breeze-icons
  -          pkgs.hicolor-icon-theme
  -
  -          kde-gtk-config
  -          breeze-gtk
  -
  -          qtvirtualkeyboard
  -
  -          pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
  -        ]
  +        let
  +          requiredPackages = [
  +            frameworkintegration
  +            kactivities
  +            kauth
  +            kcmutils
  +            kconfig
  +            kconfigwidgets
  +            kcoreaddons
  +            kdoctools
  +            kdbusaddons
  +            kdeclarative
  +            kded
  +            kdesu
  +            kdnssd
  +            kemoticons
  +            kfilemetadata
  +            kglobalaccel
  +            kguiaddons
  +            kiconthemes
  +            kidletime
  +            kimageformats
  +            kinit
  +            kirigami2 # In system profile for SDDM theme. TODO: wrapper.
  +            kio
  +            kjobwidgets
  +            knewstuff
  +            knotifications
  +            knotifyconfig
  +            kpackage
  +            kparts
  +            kpeople
  +            krunner
  +            kservice
  +            ktextwidgets
  +            kwallet
  +            kwallet-pam
  +            kwalletmanager
  +            kwayland
  +            kwayland-integration
  +            kwidgetsaddons
  +            kxmlgui
  +            kxmlrpcclient
  +            plasma-framework
  +            solid
  +            sonnet
  +            threadweaver
  +
  +            breeze-qt5
  +            kactivitymanagerd
  +            kde-cli-tools
  +            kdecoration
  +            kdeplasma-addons
  +            kgamma5
  +            khotkeys
  +            kscreen
  +            kscreenlocker
  +            kwayland
  +            kwin
  +            kwrited
  +            libkscreen
  +            libksysguard
  +            milou
  +            plasma-integration
  +            polkit-kde-agent
  +
  +            plasma-desktop
  +            plasma-workspace
  +            plasma-workspace-wallpapers
  +
  +            breeze-icons
  +            pkgs.hicolor-icon-theme
  +
  +            kde-gtk-config
  +            breeze-gtk
  +
  +            qtvirtualkeyboard
  +
  +            pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
  +          ];
  +          optionalPackages = [
  +            plasma-browser-integration
  +            konsole
  +            oxygen
  +          ];
  +        in
  +        requiredPackages
  +        ++ utils.removePackagesByName optionalPackages cfg.excludePackages
   
           # Phonon audio backend
           ++ lib.optional (cfg.phononBackend == "gstreamer") libsForQt5.phonon-backend-gstreamer
  
positive.code:       default = false;
      };
  
      # Internally allows configuring kdeglobals globally
      kdeglobals = mkOption {
        internal = true;
  
negative.code: { config, lib, pkgs, utils, ... }:
  
  let
    xcfg = config.services.xserver;
  