If you're interested in actually making this a reality, I recommend in engaging in your country's environmental policy community -- and bringing a lot of patience.
Over at KDE we've some something in that direction - we've worked with the German federal environment ministry on extending the criteria for Germany's Blue Angel environmental label with rules for software products. The resulting criteria include language about what's needed to keep old hardware running and useful (as unnecessary HW replacement spikes the environmental footprint); including using open source to enable the required maintenance.
Eventually, this will have an effect, e.g. when government procurement rounds require bidders to achieve this label, and others start aligning with government practice.
I think what's needed from the government side is indemnity for copyright and patent infringement on open-sourced code. What I've always heard is that AMD steals Nvidia's IP, Nvidia steals AMD's IP, etc. so if they ever open-sourced their highest-performance graphics drivers, they would each sue each other into oblivion since the "borrowing" is now out in the light of day. (Remember that "steals" can mean AMD hires an engineer from Nvidia, they run into the same problem 2 years later, and accidentally solve it the same way they did at their other employer. To someone reading the code or a court, that looks identical to coming into Nvidia's office through a vent and stealing a hard drive. But the intent was never malicious.)
If we removed the concept of trade secrets and made copyright and patents on software last for only 5 years, then this problem would go away.
For an example / cautionary tale, look at happened with Google's range check function in the Java standard library. Millions of dollars spent litigating over 4 lines of code. Nobody will ever want to open-source anything again, especially if they independently discovered some clever graphics optimization.
Whatever fines governments can levy for not complying with these environmental regulations probably pale in comparison to what infringement lawsuits cost to defend, so I think that's what regulations have to attack.
So right now, companies are scared about the legal risk that open source exposes them to. It's easier for entities that wish you harm to find infringement in code they can just look at, instead of encrypted binaries that are sent to the "Trust Zone" inside hardware. Because it's easy, people look. And if they find it, the company that open-sourced the thing is ruined. "You copied me too" isn't a defense to copyright infringement; you'd have to prove it to make them settle, and if their code isn't open-source, you can't do it.
Software patents is a disaster, a lot like patenting mathematics, it's ridiculous and we can all imagine what would happen if there was one company with a patent on calculus, ray tracing or matrices... it would hold everything back.
I saw this presented at Bits & Bäume conference - excellent work! I've previously heard other, very high-level approaches on "sustainable software", but few seem to care to bring all the ideas into practice. KDE does, apparently!
Over at KDE we've some something in that direction - we've worked with the German federal environment ministry on extending the criteria for Germany's Blue Angel environmental label with rules for software products. The resulting criteria include language about what's needed to keep old hardware running and useful (as unnecessary HW replacement spikes the environmental footprint); including using open source to enable the required maintenance.
Eventually, this will have an effect, e.g. when government procurement rounds require bidders to achieve this label, and others start aligning with government practice.
https://eco.kde.org/