The Meowgorithm Dotfiles, Collectors’ Edition
#!/usr/bin/env bash
set -euo pipefail
source "$PWD/modules/home/bash/bash_funcs"
GREEN_CHECK="$(printf '\x1b[32m✓\x1b[m')"
ensure() {
local name="$1"
local cmd="$2"
local script="$3"
# Require curl for installation checks.
if ! command -v curl &>/dev/null; then
printf "curl is not installed. Please install curl first.\n"
return
fi
if ! command -v "$cmd" &>/dev/null; then
echo "Installing $name..."
$script
else
printf "%s %s is installed.\n" "$GREEN_CHECK" "$name"
fi
}
install_v() {
local here="$PWD"
local targetDir="$HOME/src/v"
rm -rf "$targetDir"
mkdir -p "$targetDir"
git clone --depth=1 https://github.com/vlang/v "$targetDir"
cd "$targetDir"
make
sudo ./v symlink
cd "$here"
}
ensure "Nix" "nix" "sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install)"
ensure "Homebrew" "brew" "sh -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""