diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index 796d632..564d7ba 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -7,6 +7,7 @@ ./utilities.nix ./hammerspoon.nix ./alacritty.nix + ./homebrew.nix ]; options = with lib; { diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix index 45871d4..8490350 100644 --- a/modules/darwin/homebrew.nix +++ b/modules/darwin/homebrew.nix @@ -1,10 +1,11 @@ -{ ... }: { +{ config, ... }: { homebrew = { enable = true; autoUpdate = false; # Don't update during rebuild cleanup = "zap"; # Uninstall all programs not declared taps = [ + "homebrew/cask" # Required for casks "homebrew/cask-drivers" # Used for Logitech G-Hub ]; brews = [ @@ -17,9 +18,30 @@ "meetingbar" # Show meetings in menu bar "gitify" # Git notifications in menu bar "logitech-g-hub" # Mouse and keyboard management + "mimestream" # Gmail client ]; global.brewfile = true; # Run brew bundle from anywhere - global.nolock = true; # Don't save lockfile (since running from anywhere) + global.noLock = true; # Don't save lockfile (since running from anywhere) + }; + + home-manager.users.${config.user} = { + + home.activation = { + + # Always install homebrew if it doesn't exist + installHomeBrew = + config.home-manager.users.${config.user}.lib.dag.entryAfter + [ "writeBoundary" ] '' + if ! xcode-select --version 2>/dev/null; then + xcode-select --install + fi + if ! /usr/local/bin/brew --version 2>/dev/null; then + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + ''; + + }; + }; } diff --git a/modules/darwin/system.nix b/modules/darwin/system.nix index 57aba43..4762e89 100644 --- a/modules/darwin/system.nix +++ b/modules/darwin/system.nix @@ -1,5 +1,5 @@ { ... }: { - + services.nix-daemon.enable = true; system = { @@ -112,7 +112,7 @@ }; # Settings that don't have an option in nix-darwin - activationScripts.otherSettings.text = '' + activationScripts.postActivation.text = '' echo "Disable disk image verification" defaults write com.apple.frameworks.diskimages skip-verify -bool true defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true @@ -129,7 +129,7 @@ defaults write com.apple.screensaver askForPasswordDelay -int 0 echo "Show the ~/Library folder" - chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library + chflags nohidden ~/Library echo "Enable dock magnification" defaults write com.apple.dock magnification -bool true