If you can get something working, then good. But technically speaking the Nexus 5 does not have the same sensors the G2/G3 have, hence why it does not come with "Knock" as a default. So if you get a "Knock" equizlvalent working please post how here, otherwise I don't think it is possible.
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?