LnL7 / nix-darwin

nix modules for darwin
MIT License
2.82k stars 431 forks source link

Casks not updated automatically #935

Closed jonasschultheiss closed 4 months ago

jonasschultheiss commented 5 months ago

When running darwin-rebuild switch homebrew casks wont get updated. This is fine for things like a browser which I use often, but less used apps will get outdated. Using a declarative system I'd appreciate it, if all my software were to update with said command. Is there a reason why this doesn't happen? Adding greedy to all casks would probably fix this, but IMO this should be default behaviour. If this is because only greedy ones don't upgrade automatically, would it be possible to add a flag higher up to enable greedy upgrades instead of having to pass this to every cask? The command used to upgrade homebrew cask is brew upgrade --cask --greedy

mattpolzin commented 4 months ago

I think I take it from your comment that you know about the casks.<name>.greedy nix-darwin option, so your questions are (a) why can't greedy be on by default? and (b) is there some other way to make it easier to automatically update the casks?

I think the answer to (a) is that defaulting to auto-update casks would run counter to the other defaults that avoid updating things when running darwin-rebuild switch. To me, the current defaults make sense: I'd like darwin-rebuild switch to in essence be a no-op unless I have changed the nix configuration files it is building from.

As for (b), one idea that comes to mind is a little helper function that you map over your list of casks. For example:

let
  mkGreedy = caskName: { name = caskName; greedy = true; };
in
  {
    homebrew.casks = map mkGreedy [
      "google-chrome"
      "another-cask"
      "etc"
    ];
  }
jonasschultheiss commented 4 months ago

thank you, makes sense :)