dotfiles/setup-macos.sh
2024-11-07 16:25:41 -07:00

20 lines
617 B
Bash
Executable file

#!/bin/bash
set -e
# Get the current directory.
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Get the target hostname.
echo -n "Enter this machine's hostname as in flake.nix: "
read HOSTNAME
# Install Nix. Interactive.
if [ ! -d "/nix" ] || [ z"$FORCE_REINSTALL_NIX" != z"" ]; then
sh <(curl -L https://nixos.org/nix/install)
fi
# Let Nix set things up. :)
/nix/var/nix/profiles/default/bin/nix shell --extra-experimental-features nix-command --extra-experimental-features flakes nix-darwin nix-darwin --command \
darwin-rebuild --flake "${SCRIPT_DIR}#${HOSTNAME}" switch