anchor.diff:        wants = [ "network-online.target" ];
         wantedBy = [ "multi-user.target" ];
         restartTriggers = [ config.environment.etc."prosody/prosody.cfg.lua".source ];
  -      serviceConfig = {
  -        User = cfg.user;
  -        Group = cfg.group;
  -        Type = "forking";
  -        RuntimeDirectory = [ "prosody" ];
  -        PIDFile = "/run/prosody/prosody.pid";
  -        ExecStart = "${cfg.package}/bin/prosodyctl start";
  -        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
  -
  -        MemoryDenyWriteExecute = true;
  -        PrivateDevices = true;
  -        PrivateMounts = true;
  -        PrivateTmp = true;
  -        ProtectControlGroups = true;
  -        ProtectHome = true;
  -        ProtectHostname = true;
  -        ProtectKernelModules = true;
  -        ProtectKernelTunables = true;
  -        RestrictNamespaces = true;
  -        RestrictRealtime = true;
  -        RestrictSUIDSGID = true;
  -      };
  +      serviceConfig = mkMerge [
  +        {
  +          User = cfg.user;
  +          Group = cfg.group;
  +          Type = "forking";
  +          RuntimeDirectory = [ "prosody" ];
  +          PIDFile = "/run/prosody/prosody.pid";
  +          ExecStart = "${cfg.package}/bin/prosodyctl start";
  +          ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
  +
  +          MemoryDenyWriteExecute = true;
  +          PrivateDevices = true;
  +          PrivateMounts = true;
  +          PrivateTmp = true;
  +          ProtectControlGroups = true;
  +          ProtectHome = true;
  +          ProtectHostname = true;
  +          ProtectKernelModules = true;
  +          ProtectKernelTunables = true;
  +          RestrictNamespaces = true;
  +          RestrictRealtime = true;
  +          RestrictSUIDSGID = true;
  +        }
  +        (mkIf (cfg.dataDir == "/var/lib/prosody") {
  +          StateDirectory = "prosody";
  +        })
  +      ];
       };
   
     };
  
positive.code: 
        dataDir = mkOption {
          type = types.path;
          description = "Directory where Prosody stores its data";
          default = "/var/lib/prosody";
        };
  
        disco_items = mkOption {
  
negative.code:     users.users.prosody = mkIf (cfg.user == "prosody") {
        uid = config.ids.uids.prosody;
        description = "Prosody user";
        inherit (cfg) group;
        home = cfg.dataDir;
      };
  
      users.groups.prosody = mkIf (cfg.group == "prosody") {
  