It's up to each state to determine how it will award electoral votes to candidates.
Not quite. Even the practice of allotting electoral votes based upon Congressional districts would be suspect in many states. Maine and Nebraska can get away with it because the states have distinct parts, and nobody is splitting up the state to splinter the urban vote to dilute it with rural areas. Let us remember that people rarely know where the boundaries of Congressional districts are. County lines are well established almost everywhere, and you will see signs identifying township lines on major highways. Congressional districts can change every ten years due to reapportionment. People from outside Michigan would never know the division between the 6th and 7th Congressional districts by reading a road sign separating the districts.
Allotting all electoral votes by winner-take-all has been the norm since before the Civil War, so it has been done. If states deem that they will allot their votes in accordance with the national popular vote, that seems to be legal even if such has not yet been done.
Some methods would be unacceptable. The decision of a Governor or the vote of a state legislature would surely not pass Constitutional muster.
Actually the vote of the state legislature was exactly how it was done up until the Civil War. No amendments have changed that since. It is entirely up to the legislature on how to award its state's electoral votes.
There were all sorts of methods for allocating EV in the early days of the country. State legislatures doing the picking of electors was the most common to start. South Carolina used this method up until the Civil War. Some states divided the state into districts that each elected one Elector ( a state with 5 EV would be divided into 5 districts). Tennessee used a system where each county would select delegates to district conventions which in turn would select Electors. In 1892 Michigan elected it's Electors by congressional district with 2 ALelectors being selected statewide.
Long story short it is up to the states how they want to select Presidential Electors, just because it has been done almost elusively by statewide popular vote for the past 150 years does not mean other methods are prohibited.
A nice history of the Electoral College.
https://www.thegreenpapers.com/Hx/ElectoralCollege.html