Get derivation path of a nixos module service pkgs with overrideAttrs

Hi,
I’m stuck… how do we do to call the ${pkgs.cgit} of the service cgit with overrideAttrs and not create a new cgit derivation?

{ pkgs, config, ... }: 
let
  headerHtml = pkgs.writeTextFile {
    name = "header.html";
    text = builtins.readFile ./header.html;
  };

in {
 services.cgit."localhost" = {
    enable = true;
    package = pkgs.cgit.overrideAttrs ({ postInstall, ... }: {
      postInstall = ''
            ${postInstall}
            cp ${headerHtml} "$out/cgit/header.html"
      '';
    });
    settings = {
     header = "${pkgs.cgit}/cgit/header.html"; 
    };
  };
}

Thanks

Put the override in the let block and reuse that binding, or use config.services.cgit.localhost.package

Thanks a lot waffle8946,
Both methods work :pray: