A nuclear attack by Russia on Turkey would not be merely legally and abstractly an attack on the US under Article 5 of the North Atlantic Treaty which it would do massive irreparable damage to US credibility to ignore, but would almost certainly be a nuclear attack on US forces in the direct and literal sense.
In the given scenario above, Turkey attacks first, in which case Article 5 would not apply to a retaliation.
This lack of blaming is partly why Turkey and Greece had to sign at exactly the same time, so that neither could take advantage of being able to attack the other whilst being themselves shielded by NATO.
“The Parties agree that an armed attack against one or more of them in Europe or North America shall be considered an attack against them all…” -
But in practice how many Americans would be willing to go nuclear in support of a Turkish war against the Russians? In circumstances where Turkey was considered the aggressor state.
The question is how many would be willing to go nuclear in response to Russia nuking US forces in Türkiye in response to a conventional attack by Türkiye, which any plausible "Russia nukes Türkiye" scenario would involve.
In circumstances where there were only a couple thousand American casualties, and those were incurred as collateral damage rather than as primary targets, it might make sense for the US to respond with conventional airstrikes and for Russia accept those and not escalate further.
This would depend a lot on the individual president though, like I could imagine Trump/Obama being much more risk averse than personalities like Bush 2 or JFK.