zhaofengli / nix-homebrew

Homebrew installation manager for nix-darwin
MIT License
162 stars 8 forks source link

Commands `brew formulae` and `brew casks` don't work #30

Open jan4843 opened 1 month ago

jan4843 commented 1 month ago

Running brew formulae or brew casks lead to no results:

$ brew formulae
$ brew casks

In a "normal" Homebrew installation (not from nix-homebrew), these commands list all installable formulae/casks.


The issue appears to be that taps in the library don't container the .rb files Homebrew searches for, but instead taps are symlinks to the Nix store that are not being followed.

$ ls -l /opt/homebrew/Library/Taps/homebrew
homebrew-bundle -> /nix/store/l516764g0zmq60byk30brfh3m1qaz7qm-source
homebrew-cask -> /nix/store/0niaj23lc0mlray8cr9l99yal8q5sb7g-source
homebrew-core -> /nix/store/iv0ccy11khh2766zv9ak0jlm0p3zzywv-source

Relevant files:


Patching items.sh to follow symlinks could work (find -L), but I'm not sure whether it's a good idea to accumulate patches for Homebrew. Might consider proposing getting this changed upstream, even though there would be no real use case there, I guess.

jan4843 commented 1 month ago

Actually, find -L would not be sufficient. There is another issue earlier where the Bash function homebrew-items would return early because of a check for directory including $HOMEBREW_REPOSITORY that gets expanded to /opt/homebrew/Library/.homebrew-is-managed-by-nix/Library/Taps, which does not exist.