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 Homebrew Formulae to config #108

Closed gjolund closed 2 months ago

gjolund commented 3 months ago

I tried adding homebrew formulae to the config in the same way as you added the casks but it keeps throwing errors, that is the recommended way to manage homebrew formulae in this fashion?

https://mynixos.com/nix-darwin/option/homebrew.brews

  homebrew = {
    enable = true;
    brews = pkgs.callPackage ./brews.nix {};
    casks = pkgs.callPackage ./casks.nix {};
    onActivation = {
      cleanup = "zap";
    };
}:

brews.nix

_:

[
  # Development Tools
  "stripe/stripe-cli/stripe"
]
dustinlyons commented 3 months ago

All I do is look up the formula here: https://formulae.brew.sh/cask/ and add whatever is found to this list: https://github.com/dustinlyons/nixos-config/blob/main/modules/darwin/casks.nix

In your case, stripe-cli is just stripe-cli, not stripe/stripe-cli/stripe.

This is all managed by homebrew here: https://github.com/dustinlyons/nixos-config/blob/dbe92f2d71b1e4b28e9bab2af9351322c41c2f3b/modules/darwin/home-manager.nix#L30

gjolund commented 3 months ago

All I do is look up the formula here: https://formulae.brew.sh/cask/ and add whatever is found to this list: https://github.com/dustinlyons/nixos-config/blob/main/modules/darwin/casks.nix

In your case, stripe-cli is just stripe-cli, not stripe/stripe-cli/stripe.

This is all managed by homebrew here:

https://github.com/dustinlyons/nixos-config/blob/dbe92f2d71b1e4b28e9bab2af9351322c41c2f3b/modules/darwin/home-manager.nix#L30

This works for casks, but the stripe-cli is distributed as a brew formulae and is not a cask.

typically it is installed via brew install stripe-cli and not brew install --cask stripe-cli.

this is why I was trying to add the brews.nix declaration file.

dustinlyons commented 2 months ago

This configuration doesn't currently support brew formula, only casks. This is because brew formula essentially does what the nix package manager does-- install packages. But brew is imperative, nix is declarative.

You should search here for your packages instead:

https://search.nixos.org/packages?channel=24.05&show=stripe-cli&from=0&size=50&sort=relevance&type=packages&query=stripe

and add to packages.nix.

In this configuration, brew is only used for macOS apps that do not belong in nixpkgs, so you can install casks.

gjolund commented 2 months ago

This configuration doesn't currently support brew formula, only casks. This is because brew formula essentially does what the nix package manager does-- install packages. But brew is imperative, nix is declarative.

You should search here for your packages instead:

https://search.nixos.org/packages?channel=24.05&show=stripe-cli&from=0&size=50&sort=relevance&type=packages&query=stripe

and add to packages.nix.

In this configuration, brew is only used for macOS apps that do not belong in nixpkgs, so you can install casks.

ok that makes sense, thank you for the explanation