I use nixpkgs and home-manager for a consistent package management and configuration across MacOS and Linux (NixOS), which others also reported great success [1]. As noted in the article [1], home-manager has a steeper learning curve, but is much more powerful (e.g., supports providing development dependencies and environment, or even extend to Ops).
For the interested, search for some variants of “homebrew home-manager nix”, and you may find lots of resources [2][3][4].
[1]: https://lucperkins.dev/blog/home-manager/
[2]: https://www.softinio.com/post/moving-from-homebrew-to-nix-pa...
[3]: https://wickedchicken.github.io/post/macos-nix-setup/
[4]: https://dev.to/louy2/use-nix-on-macos-as-a-homebrew-user-22d