mirror of
https://github.com/nmasur/dotfiles
synced 2025-01-31 13:22:04 +00:00
49 lines
1.1 KiB
Nix
49 lines
1.1 KiB
Nix
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
...
|
||
|
}:
|
||
|
|
||
|
let
|
||
|
cfg = config.nmasur.presets.programs.homebrew;
|
||
|
in
|
||
|
|
||
|
{
|
||
|
|
||
|
options.nmasur.presets.programs.homebrew.enable =
|
||
|
lib.mkEnableOption "Homebrew macOS package manager";
|
||
|
|
||
|
config = lib.mkIf cfg.enable {
|
||
|
# Requires Homebrew to be installed
|
||
|
system.activationScripts.preUserActivation.text = ''
|
||
|
if ! xcode-select --version 2>/dev/null; then
|
||
|
$DRY_RUN_CMD xcode-select --install
|
||
|
fi
|
||
|
if ! /opt/homebrew/bin/brew --version 2>/dev/null; then
|
||
|
$DRY_RUN_CMD /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||
|
fi
|
||
|
'';
|
||
|
|
||
|
# Add homebrew paths to CLI path
|
||
|
home.sessionPath = [ "/opt/homebrew/bin/" ];
|
||
|
|
||
|
homebrew = {
|
||
|
enable = true;
|
||
|
onActivation = {
|
||
|
autoUpdate = false; # Don't update during rebuild
|
||
|
cleanup = "zap"; # Uninstall all programs not declared
|
||
|
upgrade = true;
|
||
|
};
|
||
|
global = {
|
||
|
brewfile = true; # Run brew bundle from anywhere
|
||
|
lockfiles = false; # Don't save lockfile (since running from anywhere)
|
||
|
};
|
||
|
brews = [
|
||
|
];
|
||
|
casks = [
|
||
|
];
|
||
|
};
|
||
|
|
||
|
};
|
||
|
}
|