From 51bf4161b27b078e62956d24f7b9c01fa793fdb6 Mon Sep 17 00:00:00 2001
From: Jacob Babor <jacob@babor.tech>
Date: Mon, 28 Nov 2022 15:57:31 -0600
Subject: [PATCH] Add some brew compat (possibly?)

---
 base/.profile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/base/.profile b/base/.profile
index baa21d5c..3e946fe4 100755
--- a/base/.profile
+++ b/base/.profile
@@ -53,6 +53,21 @@ has() {
 	command -v "$1" > /dev/null 2>&1
 }
 
+# Source in homebrew configuration, if we have it installed
+if has brew; then
+	brewfix=/usr/local
+	# This patch is needed on Apple silicon
+	if [ -f /opt/homebrew/bin/brew ]; then
+		brewfix="/opt/homebrew"
+	fi
+	eval "$("$brewfix"/bin/brew shellenv)"
+	# Add coreutils to path, if we can
+	if [ -d "$brewfix"/opt/coreutils/libexec/gnubin ]; then
+		export PATH="$brewfix/opt/coreutils/libexec/gnubin:$PATH"
+	fi
+	unset brew
+fi
+
 # Grab pip completion, if it exists
 if has pip; then
 	case "$_baseshell" in