added install script and git config

This commit is contained in:
2026-10-20 13:47:55 -04:00
parent 863b47e663
commit 3cf16ff880
2 changed files with 40 additions and 0 deletions

27
install.sh Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
echo "==> Checking for Nix..."
if ! command -v nix >/dev/null 2>&1; then
echo "==> Installing Nix vis Determinate Systems installer..."
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
else
echo "Nix already installed, skipping."
fi
echo "==> Copying config to /etc/nix-darwin..."
sudo mkdir -p /etc/nix-darwin
sudo cp -r . /etc/nix-darwin
sudo chown -R root:wheel /etc/nix-darwin
echo "==> Renaming conflicting shell files if present..."
[ -f /etc/bashrc ] && sudo mv /etc/bashrc /etc/bashrc.before-nix-darwin
[ -f /etc/zshrc ] && sudo mv /etc/zshrc /etc/zshrc.before-nix-darwin
[ -f /etc/zshenv ] && sudo mv /etc/zshenv /etc/zshenv.before-nix-darwin
echo "==> Bootstraping nix-darwin..."
nix run nix-darwin/master#darwin-rebuild -- switch --flake /etc/nix-darwin
echo "==> Done! Restart your terminal to apply all changes."