From f3f0d4b23b5dd8e14a892edeae03558ff024761f Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Tue, 5 Nov 2024 19:55:45 +0700 Subject: [PATCH] chore(bootstrap): Don't use doas on macOS, also install nix on bootstrap --- bootstrap | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bootstrap b/bootstrap index 4e99e95..531dcb2 100755 --- a/bootstrap +++ b/bootstrap @@ -34,8 +34,13 @@ case "$OSTYPE" in esac [ "$SUDO" = "" ] && { FALLBACK_SUDO="sudo" - is_package_exists doas && SUDO="doas" || SUDO=$FALLBACK_SUDO - doas echo "" >/dev/null 2>/dev/null || SUDO=$FALLBACK_SUDO + case $DISTRO in + "apple" ) SUDO=$FALLBACK_SUDO ;; # There's no good doas implementation for macOS + * ) + is_package_exists doas && SUDO="doas" || SUDO=$FALLBACK_SUDO + doas echo "" >/dev/null 2>/dev/null || SUDO=$FALLBACK_SUDO + ;; + esac } [ "$PACMAN" = "" ] && { case $DISTRO in @@ -86,6 +91,11 @@ install_aur_package() { esac } +install_nix() { + is_package_exists nix && { echo "nix is already installed, skipping..."; return; } + curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install +} + # === Actual automation === echo "Linking x* configs..." @@ -108,6 +118,9 @@ case $DISTRO in * ) echo "Not implemented, skipping..." ;; esac +echo "Installing nix..." +install_nix + echo "Changing default shell to zsh..." $SUDO chsh -s $(which zsh)