This repository contains my personal dotfiles for configuring my development environment on macOS.
Note
Before applying the new configurations, it's a good idea to back up your existing dotfiles. You can do this by renaming them or moving them to a backup directory.
Before restoring the dotfiles, ensure you have the following installed:
-
Install Xcode Command Line Tools: Open your terminal and run:
xcode-select --install
-
Install Homebrew: Run the following command in your terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install Nix: Use the following command to install Nix using the Determinate Systems installer for macOS (multi-user install):
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
Check that your installation was successful by running:
nix --version
-
Bootstrap nix-darwin: After installing Nix, you can bootstrap nix-darwin by running the following commands:
mkdir -p ~/.config/nix/ cd ~/.config/nix/ nix flake init -t nix-darwin sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nix nix run nix-darwin --extra-experimental-features "nix-command flakes" -- switch --flake ~/.config/nix
Check to see that the installation was successful by running:
type darwin-rebuild
-
Clone the repository:
git clone --depth 1 https://github.com/francojc/dotfiles.git ~/.dotfiles
-
Navigate to the dotfiles directory:
cd ~/.dotfiles
-
Remove any existing files that may conflict with the configurations:
rm -rf ~/.zshrc ~/.zshenv ~/.zsh ~/.config/nix
-
Make sure the
flake.nix
hostname to match the system hostname:To find the hostname, run the following command:
hostname
-
Apply the configurations using the full path to the flake's directory:
NIXPKGS_ALLOW_UNFREE=1 darwin-rebuild switch --flake ~/.dotfiles/.config/nix/#<yourhostname> --impure
Note: After a successful switch, you will be able to use the alias
switch
to apply the configurations in the future. -
Use
stow
to symlink the configurations:cd ~/.dotfiles stow .