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^{\mu}_{\nu}=\delta^{\mu}_{\nu}$.
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?
Edit I: Just to clarify, $\phi$ depends only on $t$ and is independent of $x^i$.
Edit II: Okay, I solved it. Here's the way to do it: \begin{equation}T_{\mu\nu}=g_{\mu\nu}\mathcal{L}-2\frac{\partial\mathcal{L}}{\partial X}\partial_{\mu}\phi\partial_{\nu}\phi.\end{equation} \begin{equation}\rho=T^0_{ 0}=\mathcal{L}-2\frac{\partial\mathcal{L}}{\partial X}\dot{\phi}^2\end{equation} \begin{equation}P=T^i_{ i}=\mathcal{L}\end{equation}.
where $X=\partial_{\mu}\phi\partial_{\nu}\phi$.