anchor.diff:  
           wantedBy = [ "multi-user.target" ];
   
  -        after = [ "pict-rs.service" ] ++ lib.optionals cfg.database.createLocally [ "lemmy-postgresql.service" ];
  -
  -        requires = lib.optionals cfg.database.createLocally [ "lemmy-postgresql.service" ];
  +        after = [ "pict-rs.service" ] ++ lib.optionals cfg.database.createLocally [ "postgresql.service" ];
  +
  +        requires = lib.optionals cfg.database.createLocally [ "postgresql.service" ];
   
           serviceConfig = {
             DynamicUser = true;
  
positive.code:           ExecStart = "${pkgs.nodejs}/bin/node ${pkgs.lemmy-ui}/dist/js/server.js";
          };
        };
  
        systemd.services.lemmy-postgresql = mkIf cfg.database.createLocally {
          description = "Lemmy postgresql db";
          after = [ "postgresql.service" ];
          partOf = [ "lemmy.service" ];
          script = with cfg.settings.database; ''
            PSQL() {
              ${config.services.postgresql.package}/bin/psql --port=${toString cfg.settings.database.port} "$@"
            }
            # check if the database already exists
            if ! PSQL -lqt | ${pkgs.coreutils}/bin/cut -d \| -f 1 | ${pkgs.gnugrep}/bin/grep -qw ${database} ; then
              PSQL -tAc "CREATE ROLE ${user} WITH LOGIN;"
              PSQL -tAc "CREATE DATABASE ${database} WITH OWNER ${user};"
            fi
          '';
          serviceConfig = {
            User = config.services.postgresql.superUser;
            Type = "oneshot";
            RemainAfterExit = true;
          };
        };
      };
  
  }
  
negative.code:       });
  
        services.postgresql = mkIf cfg.database.createLocally {
          enable = true;
          ensureDatabases = [ cfg.settings.database.database ];
          ensureUsers = [{
            name = cfg.settings.database.user;
            ensurePermissions."DATABASE ${cfg.settings.database.database}" = "ALL PRIVILEGES";
          }];
        };
  
        services.pict-rs.enable = true;
  