How to override service settings in home-manager polybar module

I use home-manager and flake installed independently, but I don’t know how to override the systemd.user.services.polybar section in polybar.nix. Can someone help me, I’d be very grateful!

systemd.user.services.polybar = {
      Unit = {
        Description = "Polybar status bar";
        PartOf = [ "tray.target" ];
        X-Restart-Triggers = mkIf (configFile != null) "${configFile}";
      };

      Service = {
        Type = "forking";
        Environment = "PATH=${cfg.package}/bin:/run/wrappers/bin";
        ExecStart =
          let scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
          in "${scriptPkg}/bin/polybar-start";
        Restart = "on-failure";
      };

      Install = { WantedBy = [ "tray.target" ]; };

What exactly do you want to “override”?

I want to override the service section in the module.

What part of it?

Most of the time it should be enough to just use lib.mkForce.

I want to cover this part

What exactly of it?

(Keep adding text for 20 character minimum)

I would like to replace the above with:

    systemd.user.services.polybar = {
      Unit = {
        Description = "Polybar status bar";
        X-Restart-Triggers = mkIf (configFile != null) "${configFile}";
        Requisite = [ "bspwm-session.target" ];
        After = [ "bspwm-session.target" ];
        PartOf = [ "bspwm-session.target" ];
      };

      Service = {
        Type = "forking";
        Environment = "PATH=${cfg.package}/bin:/run/wrappers/bin";
        ExecStart =
          let scriptPkg = pkgs.writeShellScriptBin "polybar-start" cfg.script;
          in "${scriptPkg}/bin/polybar-start";
        Restart = "on-failure";
      };
    };

Even possible, I would like to remove the systemd.user.services.polybar={...}

Have you tried using lib.mkForce, as I suggested?

I don’t understand

Though you are not really changing anything, just adding the dependencies to the bspwm targets.

Should be totally fine to just add those values, leaving the rest alone.