Probably. It requires finding a job, or having a lot of money, though, as you aren't immigrating to Scotland, but to the UK. UK's visa and immigration website [1] is actually very straight forward and easy to navigate for anyone wanting more info.
> What's actually required to gain residency (and is it permanent)?
There are a few paths to permanent residency (not necessarily citizenship). The simplest is via by getting a job that sponsors your visa and staying at it for 5 years, and then applying for right to remain. You will not be a citizen, but you will have the right to stay regardless of your job, and may be eligible for public funds.
The next best option is the Entrepreneur Visas. Option 1: £200k of your own money (can be from friends, family investors, etc) ready to invest in starting a company, or Option 2: £50k of money from registered UK VC fund or a UK government seed grant (not sure how easy this is).
Both options give you a 3 year visa extendable to 6 years 4 months, and at 5 years, you are eligible for the right to remain in the UK.
> Is there a path to citizenship?
There definitely is, but it is complicated, and maybe unnecessary. There is a kid on YouTube [2] who talks more about this.
> And with Brexit looming, will this all change in a few years?
I'm not a soothsayer, but I'd wager most of my weekly allowance (~$70) on yes.
Even if the UK moves to a points-based system post-Brexit, I'd imagine a mid- to late-career software developer or similar would easily be able to clear any 'desirability' / skill requirement and salary hurdles.
(Although trying to predict policy post-Brexit is probably a losing game. There's any range of choices from 'the UK doesn't leave the EU' to 'the UK leaves and Scotland leaves the UK').