The former Republic of Ireland winger Duff, 36, has made over 400 Premier League appearances for Blackburn Rovers, Newcastle, Fulham and Chelsea.
He had spell with Melbourne City last season before returning to Ireland to join Pat Fenton's League of Ireland side. He is expected to make his debut for Rovers in August.
A unique clause in his contract will apparently see whatever wage is agreed upon for the 100-times-capped star go directly to a charity of Duff's choosing.
Mbappe celebrates new contract with a hat-trick in PSG's 5-0 thumping of Metz
“I am very excited to have signed for the club," said Duff.
"It’s great to have it all finalised and now I’m just really looking forward to getting back on the pitch. I am still out with a bit of an injury, but I should be ready to get back training fully before the end of the month. After that I will be very keen to get back playing regularly.
I have always said that I wanted to come back and play in Ireland and I am very grateful to Pat and the club for giving me the chance to do that. Not only do I get the chance to come back and play, but I get to do it at the biggest club in the country.
“I am as excited about this move as I have been about any in my career, be that Newcastle, Chelsea or any other. I left Ireland 20 years ago to go and make a career as a footballer and so now it’s great to be back. And I am definitely not just here to see out my time as a player; I intend to make a positive contribution to Shamrock Rovers and to the league.”
Shamrock Rovers fans
Image credit: PA Sport
Duff won two Premier League titles and two League Cups with Chelsea before helping Fulham to an unlikely Europa League final in 2009. In the same year, he ranked in the top 100 of FourFourTwo's annual Football Rich List with a personal wealth of around £14 million.
But while many footballers can never have enough money, Duff is happy to end his memorable career on a very touching note.
There has been no official word on which charity will serve as the beneficiary of this gesture - that will likely be confirmed when Shamrock Rovers formally announce the deal - but the smart money for the time being is on Heart Children Ireland, a cause for which Duff currently serves as an ambassador.
Contrast's Duff's act of charity with the surreal Gervinho report from less than a fortnight ago, where his move from reputable Roma to the obscure but lucrative top flight in Abu Dhabi fell through because the former Arsenal man was not granted his own personal helicopter and private beach.
Mbappe confirms PSG stay, delivers video message on top of Parc des Princes
Barcelona line up Lewandowski swoop - Paper Round
Share this article