Running mains into the 'project box' is never a good idea .. it's way too easy to fry the Pi (or the human
Better to 'double use' some other cable with 12v or 24v == so what other 'connections' do you have to the Pi box ??
IF the PI box is wired to Ethernet, a DIY Power over Ethernet (PoE) solutuon is the best choice .. (pair of 'injector' / 'spli out' cables are about £1 eBay, a 12v DC PSU (at the Router, injector end) is less than £2, and a 12v-5v DC-DC converter (at Pi, split-out end) is about 50p)
== I use this all the time (except with 12v 'injector' only as I'm using a Pi Zero + microUSB Ethernet dongle = lots of space inside for the DC-DC converter) & back-driving the Pi from the hub.
IF you are using the Pi + Pi camera & TVout (for analogue CCTV), you can use Power over Co-ax ... (most CCTV recorders have this option, you don't even need a seperate PSU = it's usually 12v (sometimes 24v = older units might even be 24v AC !) but do need DC-DC at Pi end)
IF you want a totally stand-alone solutuion (WiFi, no wires) then a Solar cell panel + PowerBank battery (DIY combo.) can be used for the Pi Zero(-W) although that starts to become very expensive as the power requirements go up eg for full 8Hr night-time use with lights..