summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorMichael Hoang <Enzime@users.noreply.github.com>2024-11-12 23:33:43 +0000
committerGitHub <noreply@github.com>2024-11-12 23:33:43 +0000
commit6c71c49e2448e51ad830ed211024e6d0edc50116 (patch)
treee8f31e87316fd240d1752dfada0b652542f0d7fa /modules/system
parent839fd2a2b5bb60a6c15f2347a92269d57d51012f (diff)
parent67fbc7aa24cf0f4b5322b6f99fb3856bb9a1ab08 (diff)
Merge pull request #961 from codingCoffee/homebrewcheck
feat: check if homebrew exists
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/checks.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/system/checks.nix b/modules/system/checks.nix
index ec6e3b5..ab6ea19 100644
--- a/modules/system/checks.nix
+++ b/modules/system/checks.nix
@@ -28,6 +28,7 @@ let
fi
'';
+
oldBuildUsers = ''
if dscl . -list /Users | grep -q '^nixbld'; then
echo "error: Detected old style nixbld users, aborting activation" >&2
@@ -283,6 +284,19 @@ let
exit 2
fi
'';
+
+ homebrewInstalled = ''
+ if [[ ! -f ${escapeShellArg config.homebrew.brewPrefix}/brew ]]; then
+ echo "error: Using the homebrew module requires homebrew installed, aborting activation" >&2
+ echo "Homebrew doesn't seem to be installed. Please install homebrew separately." >&2
+ echo "You can install homebrew using the following command:" >&2
+ echo >&2
+ # shellcheck disable=SC2016
+ echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' >&2
+ echo >&2
+ exit 2
+ fi
+ '';
in
{
@@ -331,6 +345,7 @@ in
nixInstaller
(mkIf cfg.verifyNixPath nixPath)
oldSshAuthorizedKeysDirectory
+ (mkIf config.homebrew.enable homebrewInstalled)
];
system.activationScripts.checks.text = ''