about summary refs log tree commit diff
path: root/modules/darwin/homebrew.nix
blob: 26678289dd991dd2406b757775cfd7aa2b1aefaf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
  config,
  lib,
  ...
}:
with lib; let
  cfg = config.nixfiles.modules.homebrew;
in {
  options.nixfiles.modules.homebrew.enable = mkEnableOption "Homebrew";

  config = mkIf cfg.enable {
    hm.programs.bash.initExtra = mkAfter ''
      if [ -x "/opt/homebrew/bin/brew" ]; then
        export PATH="$PATH:/opt/homebrew/bin"
      fi
    '';

    # This option requires an installed Homebrew[1].
    #
    # [1]: https://daiderd.com/nix-darwin/manual/index.html#opt-homebrew.enable
    # [1]: https://brew.sh
    homebrew = {
      enable = true;
      onActivation = {
        autoUpdate = true;
        cleanup = "zap";
        upgrade = true;
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3