With the Senate rejecting a House spending bill that included money for President Trump’s border wall, the federal government looks headed for a shutdown at midnight.

The Senate declined to even vote on a short-term spending package containing $5 billion of wall funding that the House passed Thursday, knowing it could not get the 60 votes needed. President Donald Trump’s sudden refusal to sign anything without wall funding has thrown Congress into a tailspin with just hours to go until a shutdown.

The president sent a series of confrontational tweets on Friday morning urging Mitch McConnell to hold a vote on a funding bill sure to fail. Then he urged the Senate Majority Leader to “go nuclear” and abandon Senate rules to get it done, an idea McConnell rejected.

At issue is Trump’s red line on $5 billion for a border wall, something Democrats universally oppose. The Republican-controlled House passed a bill that includes the $5 billion, but the Senate, which needs Democrats and Republicans to pass anything needing 60 votes, is set to reject it. The Senate has already passed a bipartisan “clean” bill to fund the government into February — without the border money attached.

Democrats take control of the House in less than two weeks, after which it would be much harder for Trump to get his money approved.

Trump had previously supported the clean-bill plan, but did an about-face on Thursday after pressure from conservatives. With no clear direction on what Trump would be willing to sign, Congressional leaders are essentially going back to the drawing board.

“There is no path forward for the House bill,” Sen. Jeff Flake (R-AZ) said on the Senate floor Friday night. “What I wanted to do with not proceeding is demonstrate that not all Republicans would be for the House bill either.”

Republican and Democratic leaders of both chambers will now have to hash out a deal with Trump, the person who created the two-day long crisis by going back on his word that he would sign a short-term spending bill even if it didn’t contain funding for his wall. Trump is staying in DC for the holidays, but we don’t yet know how long these negotiations will take.

What we do know is the government is definitely shutting down — at least for some period of time.

What happened Friday

On Friday afternoon, the Senate voted on a motion on whether to take up the House bill including the $5 billion in funding for Trump’s border wall. But they never made it to the final vote.

Senators of both parties spent Friday scrambling to find a solution to the impasse. At one point, Vice President Mike Pence, incoming Chief of Staff Mick Mulvaney, and senior adviser Jared Kushner paid a visit to Senate Minority Leader Chuck Schumer and then to House Republicans to try to strike a deal. Ultimately, it was to no avail.

The Senate passed a short-term spending bill on Wednesday which kept border security funding at current levels, but the House passed a different version that added in the $5 billion in border wall funding the president wanted.

Trump had seemed to be willing to sign the Senate’s “clean” spending bill earlier this week, but sharply changed course. The result is that parts of the government are set to shut down at midnight unless there is a dramatic breakthrough. (This bill impacts 25 percent of the government, the other 75 percent is already funded.)

On Friday morning, Trump blamed Democrats for the potential government shutdown and said it could “last for a very long time.”

The Democrats, whose votes we need in the Senate, will probably vote against Border Security and the Wall even though they know it is DESPERATELY NEEDED. If the Dems vote no, there will be a shutdown that will last for a very long time. People don’t want Open Borders and Crime! — Donald J. Trump (@realDonaldTrump) December 21, 2018

The president’s focus on Senate passage of the border wall money has even prompted him to call on the upper chamber to use the “nuclear option,” which would blow up Senate rules so that the spending bill would only require a simple majority to pass, instead of the current 60 votes that it needs. (Senate Majority Leader Mitch McConnell has already rejected this idea.)

How this could end

The working assumption that if the government shuts down, it will one day reopen.

At the very least, Democrats will retake the House in January and could pass a new version of the clean Senate bill, which Trump would be forced to sign or veto.

Schumer and House Minority Leader Nancy Pelosi (who is poised to become the next speaker) have made it clear they won’t agree to $5 billion of border wall funding. The question now is whether they will consider a lower sum for border security, potentially in exchange for a deal on immigration reform.

Right now, the number being thrown around is $1.6 billion in border security, but negotiations will likely keep going tonight and possibly through the weekend.

Because whatever bill comes up to the Senate needs 60 votes, which means some Democrats need to support it. Democrats know they have leverage here, and they will surely demand some concessions (like they have in the past regarding protections for DACA recipients) in exchange.

And Trump has motivation to get this done before January 3, when the House will change hands and a new Democratic majority that will not cater to his whims takes power.

What will be open and closed during a shutdown

Since roughly three-quarters of the government has been funded by existing bills, many services are set to remain intact in the case of a partial shutdown. Other programs that have been classified as “essential” will keep running as well, although some government entities like museums could see wholesale closures.

Hundreds of thousands of government employees could also be furloughed for the duration of the shutdown, though they would likely receive back pay after the fact. Here’s a list of what will and won’t be affected:

What’s still running

Social Security, Medicare, and Medicaid

Social Security, Medicare, and Medicaid are all slated to keep up their operations uninterrupted. All three programs fall under “mandatory spending” that the federal government has committed to and are not affected by the annual appropriations process. (Medicaid also relies, in part, on state spending.)

New applicants for these programs might face a wait, however.

The US Postal Service

Post offices will remain operational and mail delivery will continue. As Rachel Wolfe has written for Vox, the USPS is funded by independent sources of revenue, including the sales of products and services — so it’s not impacted by any kind of shutdown.

Veterans hospitals and benefits

The Department of Veterans Affairs has already secured its funding, so veterans hospitals will maintain their routine operations.

Veteran disability pay and GI Bill benefits are funded by their own legislation separate from the annual appropriations bills, so those would stay consistent, according to Military.com.

Food stamps

People will still be able to get food stamps and subsidized lunches, at least in the short term. But it depends on how long the shutdown lasts: In the past, the Department of Agriculture has only had limited funding to maintain them without newly approved appropriations.

The military

Active-duty members of the military are exempt from shutdown furloughs, according to a contingency plan for the Department of Homeland Security. In the past, Congress has needed to pass separate legislation to ensure that members of the military are paid in a timely fashion during shutdowns. Otherwise they could potentially see delays in their pay depending on if the shutdown extends past a certain payment cycle.

The Mueller investigation

While special counsel Robert Mueller’s investigation into Russian election interference and the Trump campaign is under the purview of the Department of Justice, it will not be affected by any appropriations stalemate since it has its own permanent source of funding, CNN reports.

Border Patrol

Border security is at the heart of the shutdown fight, and a key chunk of the staffing for it is on track to remain intact even in the face of a partial shutdown involving DHS funding. US Customs and Border Protection is classified as an “essential” service, so a majority of its employees are exempt from furloughs during the shutdown — though they could encounter lags in pay.

As Bloomberg reports, “the overwhelming majority of border patrol, emergency management and immigration enforcement staff would be able to keep doing their jobs, though with their pay delayed.”

Air traffic control and TSA

Air traffic controllers, who fall under the jurisdiction of the Federal Aviation Administration (which is under the Transportation Department umbrella), are deemed “essential” and will keep working during a partial shutdown.

Similarly, Transportation Service Administration agents are also considered “essential,” so airline travel is not expected to see disruptions on this front, according to USA Today.

The federal judiciary

The judiciary is able to maintain operations for a short period of time after funding runs out by using money it’s gathered from various courts-related fees including “funds derived from court filings,” according to the Congressional Research Service.

In 2018, the judiciary said it had the wherewithal to keep its operations open for about three weeks, notes CRS.

Washington, DC

The city now has more autonomy over its budget and should be able to maintain most of its services, despite ties to federal appropriations.

During the 2013 shutdown, city officials had to scramble to ensure that DC had the money it needed to remain operational, but since then, Congress has approved measures to insulate the impact on the city in the event of a shutdown.

What could be affected by a partial shutdown

Every agency has its own contingency plan set up in case of a shutdown, and there are a couple of key bodies, including the IRS and National Parks, that could see some pauses or breaks in service. Additionally, as MarketWatch points out, the president has the ability to determine whether any service is “essential” or not — so it’s possible he could try to shut down a key government function like air traffic control if he really wanted to make a point.

National parks

National parks, which are funded as part of the Interior Department, have long been one of the most visible government entities affected by a shutdown and that could happen again this time around. During last January’s shutdown, many national parks were still open to visitors, but they had limited staffing and closed access to various park facilities, including restrooms. It’s possible we could see a repeat of this arrangement.

Smithsonian museums and the National Zoo have previously been closed during shutdowns and would likely be shuttered again since they derive their funding from the Interior Department.

The IRS

A key body under the Treasury Department, the IRS has indicated that it plans to furlough a significant fraction of its workers under a contingency plan, since tax season has yet to get underway.

State Department services

People will still be able to obtain passports and visas, although the State Department could stop issuing them if those services are offered in buildings run by another agency that is shut down, Bloomberg reports.

Environmental and food inspections