summaryrefslogtreecommitdiff
path: root/modules/darwin/desktop/homebrew.nix
blob: d1e3649f1d53481adb3c6fa8275038a1e9387d66 (plain)
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
32
33
34
35
36
37
38
{
  config,
  lib,
  ...
}: let
  cfg = config.getchoo.desktop.homebrew;
  inherit (lib) mkDefault mkEnableOption mkIf;
in {
  options.getchoo.desktop.homebrew.enable = mkEnableOption "enable homebrew support";

  config = mkIf cfg.enable {
    homebrew = {
      enable = mkDefault true;
      caskArgs.require_sha = true;
      onActivation = mkDefault {
        autoUpdate = true;
        cleanup = "uninstall";
        upgrade = true;
      };

      casks = let
        # thanks @nekowinston :p
        skipSha = name: {
          inherit name;
          args = {require_sha = false;};
        };
        noQuarantine = name: {
          inherit name;
          args = {no_quarantine = true;};
        };
      in
        mkDefault [
          "firefox"
          (lib.recursiveUpdate (noQuarantine "chromium") (skipSha "chromium"))
        ];
    };
  };
}