Posted on

There are many ways you can use Nix. But if you're on a Mac and you want to manage the system with Nix, you need to use Nix-darwin.

One of the biggest advantages of using nix-darwin is the ability to actually configure your system settings with it. However, this presents a problem, how do I translate the macOS settings into a nix config?

One way is to browse through the nix-darwin options documentation and you'll find entries like system.defaults.NSGlobalDomain.AppleShowAllFiles which, if set to true will show hidden files in Finder.

Another way is to use the defaults utility. For example defaults domains will list all the settings domains that exist on the system. These will include all the installed applications and of course the system. You can then use defaults find <keyword> to find all the settings with that keyword. You can dump that to a file, change the settings in System Preferences to your desired values and then run the same defaults find command again and diff the two files to find the settings that have changed.

Last way I found is to use which is a nice resource that can help you find the right settings.