Skip to content

Start from your Mac

You’ve spent years getting your Mac the way you like it. current reads it back as Nix, in a file you can import as it is.

Terminal window
nix run github:sushydev/nix-plist-manager#current -- mac.nix --scope user
nix run github:sushydev/nix-plist-manager#current -- mac-system.nix --scope system

--scope user is everything home-manager applies, --scope system what nix-darwin applies as root. Import them where they belong:

# home-manager
programs.nix-plist-manager = {
enable = true;
options = import ./mac.nix;
};
# nix-darwin
programs.nix-plist-manager = {
enable = true;
options = import ./mac-system.nix;
};

Without a file name it prints to the terminal. Without --scope you get one file with both, as { user = …; system = …; }, for (import ./mac.nix).user.

Settings still at macOS’s default are left out, so the file is what you changed. The defaults come from deleting each setting and reading what System Settings shows, on the macOS version they were recorded for; settings without a known default are included, so look over the file and delete what you don’t have an opinion about. --all includes the defaults too, but declaring a default pins it: if Apple changes it in a later release, your Mac keeps the old one.

Change something in System Settings, then ask what’s different from your file:

Terminal window
nix run github:sushydev/nix-plist-manager#current -- --scope user --against mac.nix
{
applications = {
finder = {
menuBar = {
view = {
showPathBar = false;
};
};
};
};
}

Only the settings whose value on your Mac isn’t the one in mac.nix are printed, so you can copy them over.

  • --all includes the settings at macOS’s default.
  • --only <prefix> reads part of it: --only applications.systemSettings.keyboard.
  • --ui reads the settings macOS hasn’t written down yet from System Settings itself. It opens System Settings while it runs; combine it with --only to keep that short.
  • --snapshots <directory> also captures the snapshot settings (the Dock’s apps, the menu bar layout, the wallpaper) into that directory.
  • --verbose lists the settings that couldn’t be read.