This repository has no description
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758#!/usr/bin/env bashset -euo pipefail
readonly CONFIGURATION="atoll"readonly EXPECTED_USER="alakhwara"REPO_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"readonly REPO_DIRreadonly NIX_INSTALLER_URL="https://install.determinate.systems/nix"readonly DARWIN_REBUILD="github:LnL7/nix-darwin/nix-darwin-26.05#darwin-rebuild"
if [[ "$(uname -s)" != "Darwin" ]]; then echo "error: install-work.sh only supports macOS" >&2 exit 1fi
if [[ "$(id -un)" != "$EXPECTED_USER" ]]; then echo "error: the $CONFIGURATION configuration expects user $EXPECTED_USER" >&2 echo "current user: $(id -un)" >&2 exit 1fi
if ! command -v nix >/dev/null 2>&1; then echo "Installing Determinate Nix..." curl --proto '=https' --tlsv1.2 --fail --silent --show-error --location \ "$NIX_INSTALLER_URL" | sh -s -- install --no-confirmfi
# The installer updates future shells; load Nix into this process so the# bootstrap can continue without asking the user to open another terminal.if ! command -v nix >/dev/null 2>&1; then readonly NIX_DAEMON_PROFILE="/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" if [[ ! -r "$NIX_DAEMON_PROFILE" ]]; then echo "error: Nix was installed but $NIX_DAEMON_PROFILE is unavailable" >&2 exit 1 fi
# shellcheck disable=SC1090 source "$NIX_DAEMON_PROFILE"fi
NIX_BIN="$(command -v nix)"readonly NIX_BINsudo_env=("HOME=$HOME")if [[ -n "${SSH_AUTH_SOCK:-}" ]]; then sudo_env+=("SSH_AUTH_SOCK=$SSH_AUTH_SOCK")fi
echo "Applying nix-darwin configuration $CONFIGURATION..."sudo -vsudo env "${sudo_env[@]}" \ "$NIX_BIN" --accept-flake-config \ run "$DARWIN_REBUILD" -- \ switch --flake "$REPO_DIR#$CONFIGURATION"
echoecho "Work Mac installation complete. Open a new terminal to load the new environment."