dotfiles.nix/darwin/homebrew.nix

115 lines
2.9 KiB
Nix

{ config, pkgs, lib, ... }:
let
inherit (config.users) primaryUser;
caskPresent = cask: lib.any (x: x.name == cask) config.homebrew.casks;
in
{
environment.shellInit = ''
eval "$(${config.homebrew.brewPrefix}/brew shellenv)"
'';
# https://docs.brew.sh/Shell-Completion#configuring-completions-in-fish
# For some reason if the Fish completions are added at the end of `fish_complete_path` they don't
# seem to work, but they do work if added at the start.
programs.fish.interactiveShellInit = ''
if test -d (brew --prefix)"/share/fish/completions"
set -p fish_complete_path (brew --prefix)/share/fish/completions
end
if test -d (brew --prefix)"/share/fish/vendor_completions.d"
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
end
'';
homebrew.enable = pkgs.lib.homebrew-enabled;
homebrew.onActivation.autoUpdate = true;
homebrew.onActivation.upgrade = true;
# TODO: open an issue to have this make backup folders?
# homebrew.onActivation.cleanup = "zap";
homebrew.onActivation.cleanup = "uninstall";
homebrew.global.brewfile = true;
homebrew.taps = [
"homebrew/cask"
"homebrew/cask-drivers"
"homebrew/cask-versions"
"homebrew/core"
"homebrew/services"
"nrlquaker/createzap"
"unisonweb/unison"
];
homebrew.masApps = {
Bitwarden = 1352778147;
GrandPerspective = 1111570163;
"Reeder 5" = 1529448980;
Spark = 1176895641;
Tailscale = 1475387142;
Xcode = 497799835;
};
# If an app isn't available in the Mac App Store, or the version in the App Store has
# limitiations, e.g., Transmit, install the Homebrew Cask.
homebrew.caskArgs.no_quarantine = true;
homebrew.casks = [
"aerial"
"alfred"
"anytype"
"arc"
"bartender"
# "discord"
"firefox"
"hazeover"
"jitsi-meet"
"knockknock"
"krita"
# "lagrange"
"lapce"
"logi-options-plus"
"lulu"
"macsvg"
"messenger"
"miniforge"
# "obsidian"
"protonvpn"
"qflipper"
"rectangle"
"remarkable"
"secretive"
"shortcat"
"signal"
# "slack"
"stay"
"transmission-remote-gui"
"utm"
"via"
# "wacom-tablet"
# "zoom"
];
home-manager.users.${primaryUser.username} =
let
socket = "${primaryUser.homeDirectory}/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
in
lib.mkIf (caskPresent "secretive" && config ? home-manager) {
home.sessionVariables.SSH_AUTH_SOCK = socket;
programs.ssh = {
enable = true;
matchBlocks."*".extraOptions = {
IdentityAgent = socket;
};
};
};
# For cli packages that aren't currently available for macOS in `nixpkgs`.Packages should be
# installed in `../home/programs.nix` whenever possible.
homebrew.brews = [
"ffmpeg"
"fileicon"
"fzf"
"gifsicle"
"netlify-cli"
"tarsnap"
"unison-language"
];
}