Looking at the Shimano site is kind of confusing. There are 2 alfine models listed.
SG-S700-S
SG-S501-S
The first has an axle length of 187mm, and an over locknut distance of 135mm
The second has an axle length of 135mm and an over locknut distance of 187mm
I think they might have swapped the measurements.
There are 2 Nexus 8 speed hubs that I found.
SG-8C31
SG-8R36
They both show measurements of 132mm axle length, and 184mm over locknut distance. This is a difference of 3 mm in both axle length and over locknut distance.
I don't have enough knowledge to say whether or not that is close enough to be compatible. Perhaps with this information somebody else who is more experienced in this could speak to whether or not they are compatible.