-
-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homebrew: use mas
from Nixpkgs
#1329
Conversation
Currently, setting `homebrew.masApps` causes `"mas"` to automatically be added to `homebrew.brews`. Users who want to use Homebrew only for managing App Store apps and casks, like me, can override this by setting `homebrew.brews = lib.mkForce [ ];` and adding Nixpkgs’ `mas` to their `environment.systemPackages`. When the activation script path no longer depends on the built configuration’s `environment.systemPackages`, this will no longer work. Since this was originally added before `mas` was packaged in Nixpkgs and we now have a perfectly serviceable binary package, we can add it to the `$PATH` when invoking Homebrew and skip the automatic formula installation. As the Homebrew `bin` directory still comes first, users who specifically want the formula can restore the previous behaviour by explicitly adding `"mas"` to `homebrew.brews`. Closes: LnL7#1314
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks.
Users who want to use Homebrew only for managing App Store apps and casks, like me, can override this by setting
homebrew.brews = lib.mkForce [ ];
and adding Nixpkgs’mas
to theirenvironment.systemPackages
.
This did work for me, but I initially thought it wouldn’t because I pull my configuration together from multiple repos, and I had packages in homebrew.brews
(because they weren’t in Nixpkgs, or weren’t working on darwin via Nixpkgs). But it turned out that there was only one for that particular host, and it had since been fixed in Nixpkgs, so I removed it.
tl;dr – it’s not always fine to mkForce []
the list (and I wish there were better ways for manipulating lists, rather than just replacing them).
This should probably wait until NixOS/nixpkgs#379858 is merged since the Nixpkgs
mas
package is quite old right now (although it’s been working fine for me).
I have had some issues with Nixpkgs current mas
when using uninstall
, which is annoying as I have an activation script that uninstalls App Store packages that aren’t included in my nix-darwin configuration.
@@ -789,7 +785,8 @@ in | |||
# Homebrew Bundle | |||
echo >&2 "Homebrew bundle..." | |||
if [ -f "${cfg.brewPrefix}/brew" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else
condition is just an error message, so that seems okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops – I overlooked that. Yeah, totally fine, sorry.
Currently, setting
homebrew.masApps
causes"mas"
to automatically be added tohomebrew.brews
. Users who want to use Homebrew only for managing App Store apps and casks, like me, can override this by settinghomebrew.brews = lib.mkForce [ ];
and adding Nixpkgs’mas
to theirenvironment.systemPackages
.When the activation script path no longer depends on the built configuration’s
environment.systemPackages
, this will no longer work. Since this was originally added beforemas
was packaged in Nixpkgs and we now have a perfectly serviceable binary package, we can add it to the$PATH
when invoking Homebrew and skip the automatic formula installation.As the Homebrew
bin
directory still comes first, users who specifically want the formula can restore the previous behaviour by explicitly adding"mas"
tohomebrew.brews
.Closes: #1314
This should probably wait until NixOS/nixpkgs#379858 is merged since the Nixpkgs
mas
package is quite old right now (although it’s been working fine for me). I’ll take a look at that PR in the next couple days if nobody else gets around to it.cc @sellout