diff --git a/README.md b/README.md index c343a9a..4f9ff68 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,13 @@ -# Run the following command to begin +# Menno's dotfiles +Welcome to my dotfiles repository. This repository contains my dotfiles and a setup script to install them on a new system. +It should work on any system that supports nix and home-manager. + +## Install nix, home-manager and dotfiles on a new system +This script will install nix, home-manager and my dotfiles on a new system. + +Tested on: +- Ubuntu 22.04 + ``` curl -sSL https://raw.githubusercontent.com/vleeuwenmenno/dotfiles/master/setup.sh | bash -s -- "--install" ``` \ No newline at end of file diff --git a/setup.sh b/setup.sh index 8e15277..4537096 100755 --- a/setup.sh +++ b/setup.sh @@ -85,6 +85,11 @@ home_manager_setup() { fi } +switch_to_home_manager() { + echo 'Running home-manager switch...' + home-manager switch --flake ~/.dotfiles +} + # Check if parameter is help, continue or initial if [ "$1" == "-i" ] || [ "$1" == "--install" ]; then # Check if .dotfiles exists, if so stop @@ -105,15 +110,20 @@ if [ "$1" == "-i" ] || [ "$1" == "--install" ]; then # Clone dotfiles clone_dotfiles - echo 'Nix and dotfiles are installed, running initial home-manager setup...' + echo 'Nix and dotfiles are installed' + chmod +x ~/.dotfiles/setup.sh bash -c "~/.dotfiles/setup.sh -c" elif [ "$1" == "-c" ] || [ "$1" == "--continue" ]; then + echo 'Installing home-manager ...' + # Run initial home-manager setup home_manager_setup # Run initial home-manager switch - home-manager switch --flake ~/.dotfiles - echo 'Please restart your shell and enjoy your new environment!' + switch_to_home_manager + + # We're done here! + echo 'Installation complete! Please restart your shell and enjoy!' else help fi