Im using nix-darwin
to manage my macOS configs.
I would like to use desktoppr
to set the wallpaper on my screens. This works just fine when using it from the command line, but I would like this to work also during darwin-rebuild
.
The plan was to setup something like this:
- install
desktoppr
usingnix-homebrew
- use something like this to create symlinks to wallpapers that are port of my config
{
home.files = [
{ "/Users/username/.config/wallpapers".source = path/to/wallpaper_directory; }
];
}
- use
system.activationScripts.postUserActivation.text
, to calldesktoppr
and set the wallpaper, i.e.
{
system.activationScripts.postUserActivation.text = ''
echo >&2 "Switching wallpapers..."
/opt/homebrew/bin/desktoppr 0 /Users/username/.config/wallpapers/background.jpg
''
}
- run
darwin-rebuild
and apply the change.
Now running ..../desktoppr 0 /Users/username/.config/wallpapers/background.jpg
works just fine, but once I run darwin-rebuild
nothing happens. In the output I can see Switching wallpapers...
, so the code is executed and there are no errors.
Any ideas what is wrong here? My suspicion is that the symlinks are not yet created and thus the wallpaper cannot be set… Can this be fixed?
As an aside, Im more than happy to completely switch away from desktoppr
, I just want to be able to simply and declaratively set the wallpaper on my systems for different desktops.