How to filter a default NixOS module option value?

Recently I have started to take a look at the nonSource packages used on my system.
One of them is sof-firmware, which is added to my system via enableRedistributableFirmware.

I’m fine with the other firmware being added, but I don’t want to copy the list or re-implement the logic to generate the default - is there any proper way to do something like hardware.firmware = filter (some lambda) (the default / previous value) in my config? Overlays don’t work for this, right?

No, sorry. There just isn’t a way to do this. It’s one of the more annoying aspects of the module system. You have to replicate the value.

Thanks for the quick reply. That’s unfortunate but it’s good to know.

You can get the default value with options.<option path>.default, but this isn’t a default, this is just a module that sets some config.

Overlays operate on nixpkgs instances, not module system instances.

There is a previous discussion where @nrabulinski sent a PR to add the functionality you’re looking for, maybe you can give it a try.

Interesting, but with a bunch of earlier attempts linked from that PR I don’t see something like that being introduced any time soon.

Of course not, it’s too controversial. I’m just sharing how it’s possible. I maintain an eternal nixpkgs fork anyway for my config, so I’d just pull it into my fork if I wanted to use it.