anchor.diff:        security.pam.services.lightdm.enableKwallet = true;
         security.pam.services.sddm.enableKwallet = true;
   
  +      systemd.user.services = {
  +        plasma-early-setup = mkIf cfg.runUsingSystemd {
  +          description = "Early Plasma setup";
  +          wantedBy = [ "graphical-session-pre.target" ];
  +          serviceConfig.Type = "oneshot";
  +          script = activationScript;
  +        };
  +
  +        plasma-run-with-systemd = {
  +          description = "Run KDE Plasma via systemd";
  +          wantedBy = [ "basic.target" ];
  +          serviceConfig.Type = "oneshot";
  +          script = ''
  +            ${set_XDG_CONFIG_HOME}
  +
  +            ${kdeFrameworks.kconfig}/bin/kwriteconfig5 \
  +              --file startkderc --group General --key systemdBoot ${lib.boolToString cfg.runUsingSystemd}
  +          '';
  +        };
  +      };
  +
         xdg.portal.enable = true;
         xdg.portal.extraPortals = [ plasma5.xdg-desktop-portal-kde ];
   
  
positive.code:   '';
  
    set_XDG_CONFIG_HOME = ''
        # Set the default XDG_CONFIG_HOME if it is unset.
        # Per the XDG Base Directory Specification:
        # https://specifications.freedesktop.org/basedir-spec/latest
        # 1. Never export this variable! If it is unset, then child processes are
        # expected to set the default themselves.
        # 2. Contaminate / if $HOME is unset; do not check if $HOME is set.
        XDG_CONFIG_HOME=''${XDG_CONFIG_HOME:-$HOME/.config}
    '';
  
    startplasma =
  
negative.code:     (mkIf cfg.enable {
  
        # Seed our configuration into nixos-generate-config
        system.nixos-generate-config.desktopConfiguration = [
          ''
            # Enable the Plasma 5 Desktop Environment.
            services.xserver.displayManager.sddm.enable = true;
            services.xserver.desktopManager.plasma5.enable = true;
          ''
        ];
  
        services.xserver.displayManager.sessionPackages = [ pkgs.libsForQt5.plasma5.plasma-workspace ];
  
        security.wrappers = {
          kcheckpass =
            {
              setuid = true;
              owner = "root";
              group = "root";
              source = "${getBin libsForQt5.kscreenlocker}/libexec/kcheckpass";
            };
          start_kdeinit =
            {
              setuid = true;
              owner = "root";
              group = "root";
              source = "${getBin libsForQt5.kinit}/libexec/kf5/start_kdeinit";
            };
          kwin_wayland =
            {
              owner = "root";
              group = "root";
              capabilities = "cap_sys_nice+ep";
              source = "${getBin plasma5.kwin}/bin/kwin_wayland";
            };
        };
  
  