nix-darwin
nix-darwin copied to clipboard
system.defaults settings not activated on switch
The system.defaults.trackpad.Clicking = true;
does not get activated on darwin-rebuild switch --flake .
. It can be activated immediately with /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
. Could we make nix-darwin to activate by default on switching?
same issue here. other options(ex. time.timeZone) works correctly but system.defaults.*
options don't work.
I'm currently using MacBook Pro(M2, Ventura 13.4)
I know certain options require killing the Finder or Dock process to apply, but doing so makes windows jump around, etc. so that would be kind of annoying to do every rebuild. This is the first time I've seen that activateSettings
command, if that's a way to emulate whatever the UI does adding it would be a nice improvement.
I guess it would go here? https://github.com/LnL7/nix-darwin/blob/bc346a67d34a336ca3c507570875cc88038e6120/modules/system/defaults-write.nix#L120
But I came across some thoughts from 2019 about whether that binary actually applies all of the settings, and the author wasn't convinced: https://assert.cc/posts/maybe-dont-script-macos-prefs/
I'm not seeing system.defaults being applied at all, is there an extra step that I'm missing? I followed the flake install instructions
Should just work for most things. Some things require a logout/reboot to activate, unfortunately, and some seemingly don't even set properly via the defaults
interface at all (but if that applies to any we expose it's a bug). Can you show your configuration, or at least the relevant defaults
parts of it? Does simple stuff work (e.g. system.defaults.dock.orientation = "right";
, activate, then killall Dock
)? Do you get any errors when activating your configuration?
it seems like running killall Dock
was the fix for me, except that setting AppleInterfaceStyle
to null doesn't actually do anything (i confirmed with defaults read -g AppleInterfaceStyle
, which still says "Dark" rather than 2023-07-17 12:46:50.801 defaults[16422:158718] The domain/default pair of (kCFPreferencesAnyApplication, AppleInterfaceStyle) does not exist
)
Yes, that's a really unfortunate problem with our defaults system: we do not track any state and therefore null
does not mean "unset" (as that would delete all your existing defaults on first activation), but "leave at current value". Unfortunately there is nothing you can do here as a user other than explicitly delete defaults when you no longer want them.
I think that this is an unacceptable compromise and should be fixed, but it's non-trivial to do so. Ultimately nix-darwin can never be as perfectly hermetic as something like NixOS which controls the entire system; there's often a trade-off between what functionality we offer, the implementation complexity and fragility involved, and upholding full declarativity. Sorry that we failed on the latter here and I hope to work on more strongly prioritizing it in the future.
it's no problem, I appreciate the help here! just getting started with nix and nix-darwin, so this makes sense in hindsight.
thanks!