It is still too early to say how the issue of sanctuary cities will resolve, but there's no precedent so broad as the question implies. Legalization of marijuana is a very different situation, as states which have gone this far have financial motive in terms of tax revenue. It seems possible that the financial impact of declaring state and local sanctuary may be quite negative, and there is virtually no question that immigration enforcement authority by federal agencies remains.
While some court rulings had been encouraging to jurisdictions choosing to declare themselves as immigration sanctuaries, it was too early to consider them precedent, the fight is hardly over, and the language of the legislation involved in such cases has changed in ways that have not yet been tested in court. In the end, millions of dollars in federal law-enforcement grants may be powerful incentive to cooperate with the DOJ.
With a recent decision in the US 2nd Circuit Court of Appeals, the DOJ may be on it's way to establish a carrot and stick mechanism (by restricting federal law-enforcement grants) that could be use to effectively change the behavior of states and localities that currently are not cooperating with the DOJ. This sort of mechanism was successfully used in the 1970s to establish a national speed limit.
The 2nd Circuit's 77 page written opinion reversed a partial grant of summary judgement in New York District Court case, but may have broader impact because the attorneys general of seven states joined forces in arguing the federal government should be required to release grant funds to them. Thus it appears this opinion impacts the states of Washington, New York, Connecticut, New Jersey, Massachusetts, Virginia and Rhode Island. Disagreement remains between the New York appeals court decisions those in Chicago and Los Angeles.
The appeals court opinion relied on Supreme Court precedents stating that in the area of immigration law, the federal government has broad and preeminent power, but in the end did not really set any substantial new precedent, instead rejected the lower court's stated opinion there was a constitutional separation of powers issue. Less controversially, the appeals court said its decision was a plain text interpretation the provisions of [34 U.S.C. § 10153] as authorizing the US Attorney General to establish new guidelines and withhold grant funds from states under that program.