Given a lagrangian of a form:
\begin{equation}\mathcal{L}=f(\phi,\partial_{\mu}\phi\partial^{\mu}\phi)\end{equation}
where $f$ is a function, I need to derive pressure and density in a FLRW universe with $g^0_0=1$ and $g^{i}_{j}=-\delta^i_j$.

My approach is using:
\begin{equation}T_{\mu\nu}=-\frac{2}{\sqrt{-g}}\frac{\partial}{\partial g^{\mu\nu}}(\sqrt{-g}\mathcal{L})\end{equation}
\begin{equation}=g_{\mu\nu}\mathcal{L}-2\frac{\partial\mathcal{L}}{\partial g^{\mu\nu}}.\end{equation}

And finally,
\begin{equation}\rho=T^0_{ 0}\end{equation}
\begin{equation}P=T^i_{ i}\end{equation}.

The problem I am facing right now is how to explicitly use the form of lagrangian to simplify the energy momentum tensor. Can anyone please help me?