Hey Marek,
You might find my work on Parameterized Packages interesting:

https://blog.lispy.tech/parameterized-packages-the-project-completion-update.html

Unfortunately, it hasn't been merged into the main branch yet, however you should be able to make everything use -Os with the patch.

Regards,

Sarthak.


On Tue, Aug 20, 2024, 15:35 Marek Paśnikowski <marek@marekpasnikowski.pl> wrote:
Hello

In order to prevent the XY problem, here is my goal: Rebuild the entire
system with -Os optimization level.  It is an experiment into viability
of hardware-targeted optimizations.

The [2.1 Packaging Tutorial][1] of the Cookbook mentions that it is
possible to pass a #:make-flags argument to a list of packages.
Unfortunately, no explanation is given how to implement this
functionality, and which exactly lists of packages does it apply to.

Does the Guix System have a facility similar to Gentoo's [make.conf][2],
where a default optimization set can be declared? A potential problem is
with packages that are dependencies of services, like %desktop-services.
I hope those also would inherit the changes.

[1]: https://guix.gnu.org/cookbook/en/html_node/Packaging-Tutorial.html
[2]: https://wiki.gentoo.org/wiki//etc/portage/make.conf#CFLAGS_and_CXXFLAGS