LnL7 / nix-darwin

nix modules for darwin
MIT License
3.19k stars 456 forks source link

homebrew: add extraMasApps option for composability of mas apps #957

Closed abayomi185 closed 6 months ago

abayomi185 commented 6 months ago

I thought it might be good to have masApps as a list such that it is automatically merged and can be composed in different files/modules like with casks and brews.

Attempted to fit it into masApps but struggled to get the tests to pass so opted for extraMasApps option instead. Happy to make changes if this approach is not ideal.

malob commented 6 months ago

I think I'm confused about what problem this is trying to solve, e.g., in my config I have the following: https://github.com/malob/nixpkgs/blob/8b609120370553e12aeca01c5b65afdf541af2f7/darwin/homebrew.nix#L43-L67

I added the following to a separate file that's part of my config,

homebrew.masApps = {
  _11111 = 123;
};

and nix repl shows that it merges them:

nix-repl> darwinConfigurations.MaloBookPro.config.homebrew.masApps 
{ "1Password for Safari" = 1569813296; [...] _11111 = 123; }
abayomi185 commented 6 months ago

Thanks! I seemed to think this wouldn't work (merge) in Nix like it does with arrays. I searched the web but didn't think to try it out first.

Will be using nix repl more often and taking pointers from your repo.