There are buses between Nagano and Hakuba; They are operated by Alpico and you can check the schedule in the link. Unfortunately the last bus leaves Nagano at 8.10 p.m. Another bus is scheduled to leave Nagano at 9:10 p.m. However, it only runs until March 15th, so you can't use it. The first bus on the morning of the 24th leaves at 7.55 a.m. and takes you to Hakuba at 9.05 a.m. (train station) or 9.10 a.m. (Happo bus station). As far as I can tell, the JR pass is not valid.
The problem with the direct journey from Nagano to Hakuba is that they are located in two different parallel valleys and are required to cross a mountain pass. Therefore, this is not a common direction of travel, only buses serve the route and they do not do this very often. You can take the train; To do this, you'll need to take a limited express from Nagano south to Matsumoto and then local trains back north
There are two general routes from Tokyo to get to Hakuba by train:
Take a Hokuriku Shinkansen from Tokyo or Ueno station, past Nagano to Itoigawa on the north coast and from there by local train
Take the Limited Express Azusa from Shinjuku to Matsumoto and from there a local train to the valley.
However, your late arrival in Narita means that you won't be able to get from Tokyo to Hakuba on the same day, as the line between Matsumoto and Itoigawa is a very small local line with rare (Japanese-style) service. The last trains arrive in Hakuba around 10:40 p.m. You must leave Tokyo before your flight lands. So you have to break off your trip somewhere and stay overnight unless you want to spend money on a late night taxi Nagano – Hakuba (Nagano is probably the closest one that you can catch on regular trains to Hakuba before the night closes ).
I would like to suggest stopping off in Matsumoto, where Matsumoto Castle is located, one of the few remaining original Japanese castles, and definitely a sight to see if you can take your time. To do this, you must take the train from Narita Airport at 7.15 p.m. This may or may not work if your plane lands at 6 p.m.
That being said, the other most logical option is to interrupt your trip in Tokyo, i.e. H. Find a hotel there for the night. The next morning you can either hop on an early Azusa for Matsumoto or a Shinkansen to Itoigawa. In fact, there is a departure from Shinjuku at 7:30 a.m. that will take you directly to Hakuba in 4 hours.
The most recommended website for checking departure times is Hyperdia.com, where apps for iOS and Android are also available. I personally use the JapanTravel app, which is also available for iOS and Android. Google Maps and Apple Maps are also great for checking train schedules.
Note that depending on where you are in Tokyo, a different route may be faster. When looking from Tokyo station, the options for Hokuriku / Nagano Shinkansen seem to be faster, although they look less logical on a map. If you are in control of where your Tokyo hotel is located, this is worth considering.