Nixos-hardware modules and unwanted packages

Hey All,

I’m currently working with NixOS on a Mac Pro 2019. I’m having an issue with the apple-t2 module in nixos-hardware. As far as I can tell (through the t2linux guide and elsewhere) the module presupposes your t2 device is a macbookpro which unfortunately installs packages for touchbars, touchpads and specific audio needs. I’d like to eject these packages and daemons (such as tiny-dfr and apple-bce) or even compile my own kernel with just the t2 patches.

My questions is what is the path of least resistance? Thanks!

Here’s the implementation: nixos-hardware/apple/t2/default.nix at 53db5e1070d07e750030bf65f1b9963df8f0c678 · NixOS/nixos-hardware · GitHub

I think the path of least resistance would be to simply clone the project, make these things more configurable, and upstream the changes. Until it gets merged you could just depend on your local copy of nixos-hardware.

As a side benefit, that’ll be a nice community contribution to boot.

Slightly higher resistance would be maintaining a local fork where you just remove the lines that add stuff you don’t want, but that’ll be tiresome long-term.

You could also achieve this without the support of git for rebasing if you just replace the module with a local copy of the file. That’s maybe appopriate if you think you never want to update again: NixOS Manual

The path of most resistance will be filtering stuff out with lib.mkForce - I don’t really recommend this, adjusting those lists in NixOS modules is awkward since so many things write to them.