zhaofengli / nix-homebrew

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

Installation problem #5

Open jcszymansk opened 1 year ago

jcszymansk commented 1 year ago

I tried to use nix-homebrew to manage my brew installation which in turn manages brews and casks. So far it was managed with nix-darwin homebrew.* options.

After installing brews are causing no problems, but after every darwin-rebuild switch --flake . brew attempts to reinstall all casks and then finishes with the following error:

Error: Refusing to untap homebrew/cask because it contains the following installed formulae or casks:

I have also tried removing homebrew completely and installing it from scratch with nix-homebrew, to no avail, the effect is exactly the same.

My darwin configuration is as follows:

      darwinConfigurations."adapa" = darwin.lib.darwinSystem {
        system = "x86_64-darwin";
        modules = [
          nix-homebrew.darwinModules.nix-homebrew
          {
            nix-homebrew = {
              enable = true;
              user = "jsz";
              taps = with inputs; {
                "homebrew/homebrew-core" = homebrew-core;
                "homebrew/homebrew-cask" = homebrew-cask;
              };
              mutableTaps = false;
            };
          }
          ./systems/adapa/configuration.nix
        ];
      };

and homebrew related configuration in configuration.nix:

  homebrew = {
    enable = true;

    onActivation = {
      cleanup = "uninstall";
      # this sucks, as the entire homebrew does. gah
      autoUpdate = true;
      upgrade = true;
    };

    global.autoUpdate = false;

    masApps = {
      "Microsoft To Do" = 1274495053;
    };

    brews = [
      "libxml2"
      "libxslt"
      "sox"
    ];

    caskArgs.no_quarantine = true;

    casks = [
     "macfuse"
     "quicksilver"
     "firefox"
     "flux"
     "maestral"
     "eclipse-jee"
     "maccy"
     "docker"
     "virtualbox"
     "soapui"
    ];
  };
gshpychka commented 8 months ago

Same here, although this does not seem to be affecting anything. @zhaofengli is this expected?

gshpychka commented 8 months ago

Figured it out - this is because nix-darwin's homebrew module is trying to untap all taps due to its taps attribute being empty by default.

Passing all taps to it solves the issue for me. In nix-darwin's homebrew:

    taps = builtins.attrNames config.nix-homebrew.taps;