Is there some sort of gun (or a way) to decorate cookies with chocolate chips or nuts?
It very much depends on the scale you desire.

Industrial Scale



From my quick youtube research, it seems like most commercial cooking making machines use an extrusion approach and are focused on dough deposition. Example: https://www.youtube.com/watch?v=J-R9nYHNTAE.

A machine like this: https://www.youtube.com/watch?v=SP6WuXUKK_M, is the most promising that I have found. There is probably some clever mechanism that could, instead of punching out the middle of the cookies, deposit a chocolate chip or nut.

Personal Scale



This is harder, because of the inherent variability in environment and types of use. I doubt something already exists/haven't been able to find it. However, I have a couple of preliminary ideas. You need several parts:


hopper to hold chips/nuts
mechanism to deposit/press chip or nut into the dough
barrel or something similar to connect the two parts.


Airsoft or paintball guns have hoppers that deal with similar style objects and are designed for handheld use. You could start by researching loading mechanisms for these guns. 

The hardest part is designing the mechanism that will actually press the chip into the cookie, because of the delicate nature of the operation.

If you wish to discuss this further, feel free to contact me using the information on my profile.