nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

Dock items are lost on every reboot

Open V4G4X opened this issue 1 year ago • 4 comments

On every reboot, dock items are lost and I return to an empty dock.
image

My nix-darwin config is simple, but I can't pinpoint the issue.

Please help!

V4G4X avatar Oct 07 '23 20:10 V4G4X

This is happening to me too. My config is a bit more complex, but this has been occurring since I first started using nix-darwin. MacOS 14.1.2.

Ovyerus avatar Dec 11 '23 13:12 Ovyerus

Did some more in-depth testing with a friend (@spotlightishere) and we figured this much out. They weren't able to reproduce this with either mine or @V4G4X's config weirdly. Running defaults read com.apple.dock shows that persistent-apps and persistent-other are filled out as expected when setting apps to stay in dock, but for whatever reason they aren't getting applied after a reboot.

I decided to do these steps as some further testing and this actually fixed it for me somehow.

  • defaults delete com.apple.dock
  • killall Dock -> The original fixed items from when Mac is first set up come back.
  • Restart system -> Those fixed items are still persisted.
  • darwin-rebuild switch --flake ~/.config/nix-darwin
  • Remove all of Apple's default fixed items from the Dock and re-add my apps.
  • Restart system -> My fixed items are persisted as expected.
  • darwin-rebuild switch --flake ~/.config/nix-darwin (had to remove /etc/bashrc and /etc/zshrc for some reason, ig it cant figure itself out)
  • Restart system -> My fixed items are still persisted.

My guess as to the cause of this is some sort of obscure corruption occurring to persistent-apps and persistent-other somehow, but I have no clue.

Ovyerus avatar Dec 12 '23 03:12 Ovyerus

What I had discovered is that after running darwin-rebuild the dock file: ~/Library/Preferences/com.apple.dock.plist is modified(empty) and becomes read-only for some reason.

And as such after every reboot, the empty version is loaded from disk.

What I straight up did is just kept a copy of a functional dock.plist file. I rarely reboot, so when I do I just cp it back into place.

Though I am curious @Ovyerus, after your list of steps did your dock work normally permanently?

Like you can add/remove items from the dock and on the next reboot those changes persist?

V4G4X avatar Dec 13 '23 15:12 V4G4X

Yup, changes are still persisting through reboots for me now.

Ovyerus avatar Dec 13 '23 21:12 Ovyerus