Skip to content
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

Unable to tap homebrew/bundle #9

Open
flexwie opened this issue Sep 28, 2023 · 6 comments
Open

Unable to tap homebrew/bundle #9

flexwie opened this issue Sep 28, 2023 · 6 comments

Comments

@flexwie
Copy link

flexwie commented Sep 28, 2023

When trying to switch to a flake with nix-homebrew enabled, I get the following error message:

==> Tapping homebrew/bundle
fatal: could not create work tree dir '/opt/homebrew/Library/Taps/homebrew/homebrew-bundle': Permission denied
Error: Failure while executing;  exited with 128.

I'm doing this on a fresh install if MacOS. Do I need to modify some permissions in order to get nix-homebrew to work?

@theowenyoung
Copy link

same...

@zhaofengli
Copy link
Owner

If you have mutableTaps = false, then you need to add the homebrew/bundle tap to your config to use nix-darwin's homebrew options.

@mg
Copy link

mg commented Oct 22, 2023

If you have mutableTaps = false, then you need to add the homebrew/bundle tap to your config to use nix-darwin's homebrew options.

Hi @zhaofengli sorry if I am asking for something obvious, but what does that mean? Do I add it do the nix-homebrew config or the darwin homebrew config? And what does it look like?

Sorry again, totally new to this and trying to figure out 100 things at the same time.

@zhaofengli
Copy link
Owner

zhaofengli commented Oct 23, 2023

There are two options to pull in taps:

  1. Let homebrew manage them imperatively: When you run brew tap koekeishiya/formulae, Brew will automatically clone https://github.com/koekeishiya/homebrew-formulae into $HOMEBREW_LIBRARY/Taps. This is only possible if you have mutableTaps = true.
  2. Declaratively specify them in your Nix configuration: All tap contents are stored in the Nix store and generated by your confioguration. When activating the nix-darwin configuration, the activation script will replace $HOMEBREW_LIBRARY/Taps with a link to the synthesized taps directory in the store. This is in effect when mutableTaps = false.

The problem you have now is that Brew will automatically run brew tap homebrew/bundle if you run brew bundle and the bundle tap isn't tapped yet. This isn't possible with mutableTaps = false, and you will need to specify the homebrew-bundle repo in the config. With a flake.nix:

{
  inputs = {
    homebrew-bundle = {
      url = "github:homebrew/homebrew-bundle";
      flake = false;
    };
  };
}

Then, you may add it to your configuration:

{
  nix-homebrew = {
    enable = true;
    mutableTaps = false;
    # ....
    taps = {
      "homebrew/homebrew-core" = inputs.homebrew-core;
      "homebrew/homebrew-cask" = inputs.homebrew-cask;
      "homebrew/homebrew-bundle" = inputs.homebrew-bundle; # <---
    };
  };
}

@mg
Copy link

mg commented Oct 23, 2023

@zhaofengli thank you for taking time to write this very clear and very helpful explanation. And thank you for this package, it is great to be able to install brew as a part of a nix configuration.

@akavel
Copy link

akavel commented Dec 6, 2023

Thank you so much @zhaofengli for this clarification!! Do you think it could make sense to add it to the readme? I feel like it might be useful to newbies like me ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants