First "NID" is a Telco term of art, it's a contractual concern more than anything else.
The first device terminates the Fiber. It has an SPF transceiver in at for the wavelength the customer is getting the service on which is 1310nm. This is pure layer 1. A technician could/would use this "NID" to get a light reading during provisioning and/or troubleshooting. This is the end of the "local loop."
The second device is the one that provides Carrier Ethernet. Carrier Ethernet is like regular Ethernet but with some extensions that allow the provider "OAM"(operation, administration and management) capabilities. This is a layer 2 device.