fix macos homebrew and system activations

This commit is contained in:
Noah Masur 2022-06-19 15:27:52 -04:00
parent bd7290fe63
commit 7861f9ec3a
3 changed files with 28 additions and 5 deletions

View File

@ -7,6 +7,7 @@
./utilities.nix ./utilities.nix
./hammerspoon.nix ./hammerspoon.nix
./alacritty.nix ./alacritty.nix
./homebrew.nix
]; ];
options = with lib; { options = with lib; {

View File

@ -1,10 +1,11 @@
{ ... }: { { config, ... }: {
homebrew = { homebrew = {
enable = true; enable = true;
autoUpdate = false; # Don't update during rebuild autoUpdate = false; # Don't update during rebuild
cleanup = "zap"; # Uninstall all programs not declared cleanup = "zap"; # Uninstall all programs not declared
taps = [ taps = [
"homebrew/cask" # Required for casks
"homebrew/cask-drivers" # Used for Logitech G-Hub "homebrew/cask-drivers" # Used for Logitech G-Hub
]; ];
brews = [ brews = [
@ -17,9 +18,30 @@
"meetingbar" # Show meetings in menu bar "meetingbar" # Show meetings in menu bar
"gitify" # Git notifications in menu bar "gitify" # Git notifications in menu bar
"logitech-g-hub" # Mouse and keyboard management "logitech-g-hub" # Mouse and keyboard management
"mimestream" # Gmail client
]; ];
global.brewfile = true; # Run brew bundle from anywhere 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
'';
};
}; };
} }

View File

@ -1,5 +1,5 @@
{ ... }: { { ... }: {
services.nix-daemon.enable = true; services.nix-daemon.enable = true;
system = { system = {
@ -112,7 +112,7 @@
}; };
# Settings that don't have an option in nix-darwin # Settings that don't have an option in nix-darwin
activationScripts.otherSettings.text = '' activationScripts.postActivation.text = ''
echo "Disable disk image verification" echo "Disable disk image verification"
defaults write com.apple.frameworks.diskimages skip-verify -bool true defaults write com.apple.frameworks.diskimages skip-verify -bool true
defaults write com.apple.frameworks.diskimages skip-verify-locked -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 defaults write com.apple.screensaver askForPasswordDelay -int 0
echo "Show the ~/Library folder" echo "Show the ~/Library folder"
chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library chflags nohidden ~/Library
echo "Enable dock magnification" echo "Enable dock magnification"
defaults write com.apple.dock magnification -bool true defaults write com.apple.dock magnification -bool true