dustinlyons / nixos-config

General purpose Nix configuration for macOS / NixOS with starter templates + step-by-step guides ✨
BSD 3-Clause "New" or "Revised" License
1.79k stars 113 forks source link

Add taps : Permission denied / exited with 128 #125

Open HugoHeneault opened 1 week ago

HugoHeneault commented 1 week ago

Hi there,

First thanks for that great repo which was a nice introduction to nix to me.

I'm trying to add taps to my setup. I read #66, and I already did as stated as a solution:

  homebrew = {
    enable = true;
+    taps = ["leoafarias/homebrew-fvm"];
+
+    brews = [
+      "leoafarias/homebrew-fvm"
+    ];

    casks = pkgs.callPackage ./casks.nix {};

But when nix run .#build-switch

It returns

Homebrew bundle...
Tapping leoafarias/fvm
==> Tapping leoafarias/fvm
fatal: could not create leading directories of '/opt/homebrew/Library/Taps/leoafarias/homebrew-fvm': Permission denied
Error: Failure while executing; `git clone https://github.com/leoafarias/homebrew-fvm /opt/homebrew/Library/Taps/leoafarias/homebrew-fvm --origin=origin --template= --config core.fsmonitor=false` exited with 128.
Tapping leoafarias/fvm has failed!
Installing leoafarias/homebrew-fvm
Warning: 'leoafarias/homebrew-fvm' formula is unreadable: No available formula with the name "homebrew-fvm".
Warning: No available formula with the name "homebrew-fvm".
Error: No formulae found for homebrew-fvm.
==> Searching for similarly named formulae...
Installing leoafarias/homebrew-fvm has failed!

Running brew tap leoafarias/fvm returns the same error message :

brew tap leoafarias/fvm                        

==> Tapping leoafarias/fvm
fatal: could not create leading directories of '/opt/homebrew/Library/Taps/leoafarias/homebrew-fvm': Permission denied
Error: Failure while executing; `git clone https://github.com/leoafarias/homebrew-fvm /opt/homebrew/Library/Taps/leoafarias/homebrew-fvm --origin=origin --template= --config core.fsmonitor=false` exited with 128.

I can't figure out what's wrong with my setup. Thank you for your help 🙏

dustinlyons commented 3 days ago

Can you run

ls -l /opt/homebrew

Is this owner by your user? Here is the dependency we use, nix-homebrew, I know they "migrate" existing configurations but maybe something went wrong.

You could also try to set this option to false (I think maybe this is default now, but something you could try regardless)

  homebrew = {
    enable = true;
    global.lockfiles = false;
  };

Otherwise I'm not exactly sure as I personally don't use taps. You can also just keep homebrew out of the configuration entirely, and have a traditional Brewfile sit next to this configuration. Just something to consider. This would enable just removing those lines from the home-manager.nix configuration file, something to unblock you regardless.