Do what you love. If you're good at it and willing to compromise reasonably, then the market will accept you. If you're not good at it you will have trouble sustaining a career for the simple reason that "junior" hires are made with the hope that the employee will improve; that prospect seems much dimmer for middle-aged candidates.
And the willingness to compromise is important too. If you are focused on a very narrow field, you may find it dissolve due to technological progress and market conditions. If you are focused on progression inside a single large employer, you may find its culture doesn't want senior hackers. Be broad, be flexible.