diff options
| author | Malo Bourgon <mbourgon@gmail.com> | 2020-12-17 16:54:29 -0800 |
|---|---|---|
| committer | Malo Bourgon <mbourgon@gmail.com> | 2020-12-17 16:54:29 -0800 |
| commit | 6b561009825e70fee1624a636566f0bc233b80a3 (patch) | |
| tree | 8c9cc36ef32fab58fca03cf50170a7bb2e5529a9 /modules/homebrew.nix | |
| parent | 9961b72463f0f0ba60f435424117d8ac98e70e8d (diff) | |
Move Homebrew installation check to activation script
Diffstat (limited to 'modules/homebrew.nix')
| -rw-r--r-- | modules/homebrew.nix | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/modules/homebrew.nix b/modules/homebrew.nix index f67945f..330006a 100644 --- a/modules/homebrew.nix +++ b/modules/homebrew.nix @@ -31,7 +31,6 @@ let optional (cfg.cleanup == "uninstall" || cfg.cleanup == "zap") "--cleanup" ++ optional (cfg.cleanup == "zap") "--zap" ); - in { @@ -191,19 +190,6 @@ in }; config = { - assertions = mkIf cfg.enable [ - { - assertion = builtins.pathExists /usr/local/bin/brew; - message = '' - Homebrew not installed. - - Please install Homebrew yourself before using the <option>homebrew</option> module. - - See installation instructions at: https://brew.sh - ''; - } - ]; - homebrew.brews = optional (cfg.masApps != {}) "mas" ++ optional (cfg.whalebrews != []) "whalebrew"; @@ -216,8 +202,11 @@ in system.activationScripts.homebrew.text = mkIf cfg.enable '' # Homebrew Bundle echo >&2 "Homebrew bundle..." - PATH=/usr/local/bin:$PATH ${brew-bundle-command} + if [ -f /usr/local/bin/brew ]; then + PATH=/usr/local/bin:$PATH ${brew-bundle-command} + else + echo -e "\e[1;31merror: Homebrew is not installed, skipping...\e[0m" >&2 + fi ''; }; - } |
