Owning/owned all the cameras and adapters talked about above.
Short story:
If you’ve only got Nikon G lenses (no aperture ring), don’t bother. You can’t easily set the aperture and so it’s not worth it.
You’re unlikely to have non-G lenses on a D40 as that means either you’d not have AF (as they need the body motor to drive them which the D40 lacks) or they’d be old lenses you’re shooting full-manual. If that’s the case, any adapter will do, you’ll still be manually focusing, but get auto exposure – crack on.
In what way is the panasonic kit lens limiting you? Quality wise they’re excellent, – I assume you mean you want a longer focal length? The panasonic 45-200 is good. Otherwise I used a manual focus nikon 70-200f/4 with an adapter till I got the pany. Should be able to pick up a decent 70-200f4 F-mount and adapter for about £40 all in…
If you’ve a G or a GH then that’s fine, the GX/GF “compacts” without the grip/viewfinder are a hassle with the longer/heavier lenses.