dotfiles/install.sh

59 lines
1.9 KiB
Bash
Raw Normal View History

2024-04-21 17:55:27 +00:00
#!/usr/bin/env bash
2024-03-12 21:48:11 +00:00
set -euo pipefail
2021-03-20 22:36:25 +00:00
2024-04-16 12:02:32 +00:00
source common.sh
2024-04-21 17:55:27 +00:00
echo_header "== DotFiles with GUI: $GUI and ENV: $ENVIRONMENT"
2024-04-26 20:34:29 +00:00
LINUX="true"
2024-04-21 17:55:27 +00:00
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo_header "== Detected linux"
./install-linux.sh
elif [[ "$OSTYPE" == "darwin"* ]]; then
2024-04-26 20:34:29 +00:00
LINUX="false"
2024-04-21 17:55:27 +00:00
echo_header "== Detected macos"
./install-macos.sh
else
echo "Error: ${OSTYPE} is not supported!"
exit 1
2024-02-01 07:32:07 +00:00
fi
2024-04-21 17:55:27 +00:00
echo_header "== Installing Nix"
if ! command -v nix; then
2024-03-09 17:47:56 +00:00
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
nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
else
echo "Already installed, skipping"
fi
2024-01-30 18:35:52 +00:00
2024-04-21 17:55:27 +00:00
echo_header "== Installing Home Manager"
2024-02-01 07:32:07 +00:00
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
2024-03-21 19:37:29 +00:00
NIXPKGS_ALLOW_UNFREE=1 ENVIRONMENT=$ENVIRONMENT nix-shell '<home-manager>' -A install
2024-01-29 23:30:26 +00:00
2024-04-21 17:55:27 +00:00
echo_header "== Installing Home Manager packages"
2024-02-01 08:17:18 +00:00
workspace_link nix/home.nix .config/home-manager/home.nix
2024-03-21 19:37:29 +00:00
workspace_link nix/core.nix .config/home-manager/core.nix
workspace_link nix/personal.nix .config/home-manager/personal.nix
workspace_link nix/work.nix .config/home-manager/work.nix
NIXPKGS_ALLOW_UNFREE=1 ENVIRONMENT=$ENVIRONMENT home-manager switch
2024-01-29 23:30:26 +00:00
2024-04-21 17:55:27 +00:00
echo_header "== Use zsh as default shell"
2024-04-26 20:34:29 +00:00
if [ "${LINUX}" == "true" ]
then
sudo chsh $USER --shell=/bin/zsh
fi
2024-01-29 23:30:26 +00:00
2024-04-21 17:55:27 +00:00
echo_header "== Plug for neovim"
2024-01-31 12:29:11 +00:00
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
2024-04-16 12:02:32 +00:00
nvim --headless +PlugInstall +qa || true
nvim --headless +PlugUpdate +qa || true
nvim --headless +PlugUpgrade +qa || true
if command -v code; then
2024-04-21 17:55:27 +00:00
echo_header "== Installing vscode extensions"
2024-04-19 07:16:26 +00:00
./vscode.sh --install
fi