Walls, no matter how solid, transmit sound vibrations. So much so that if the phenomenon did not occur, we would not be able to hear any kind of sound on the other side of it.
Of course, it is a poor transmitter, but with electronic resources, we can take advantage of the little that it transmits, acting like a diaphragm to make the listening in operations of espionage, or even out of curiosity.
This can be done in the basic form shown in Figure 1.
The ideal is to have a small amplifier which can be attached to the nail or a microphone that can support the nail directly.
A nail welded to a board can facilitate this operation, thus obtaining a good coupling.
As an amplifier, there are many options on this website, like the types powered by LM386, TDA7052 batteries and even an interesting idea is to use the recorder's phone with an external microphone.