aboutsummaryrefslogtreecommitdiffstats
path: root/setup.sh
blob: 5ffe5dcd30f86a2ea7e3ad399f69a7d375f36cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# Fedora Workstation - Setup
# Author: Alex Schofield (@ajschofield)
#
# This script sets up dotfiles and configuration files on a new system.

set -e  # Exit immediately if something fails

# Get sudo privileges before continuing...
sudo -v
echo "We should be good to go!"

# Update everything before continuing
echo "Fetching new updates and installing..."
sudo dnf update -y

# Install the bare essentials
sudo dnf install -y rust cargo neovim sway kitty curl git zsh

# Install lvim (taken from lunarvim.org/docs/installation)

if [ ! -f ~/.local/bin/lvim ]; then
    LV_BRANCH='release-1.4/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh)
fi

# Install oh-my-posh

if [ ! -f ~/.local/bin/oh-my-posh ]; then
    curl -s https://ohmyposh.dev/install.sh | bash -s -- -d ~/.local/bin
fi

# Clone the dotfiles repository
DOT_DIR="$HOME/.dotfiles"
if [ -d "$DOT_DIR" ]; then
    echo "Dotfiles directory already exists. Pulling latest changes..."
    git -C "$DOT_DIR" pull
else
    echo "Dotfiles directory doesn't exist. Cloning..."
    git clone https://github.com/ajschofield/dotfiles "$DOT_DIR"
fi

# Apply the configurations using symlinks
echo "Applying configurations..."

# nvim/lvim configuration
LVIM_SRC="$DOT_DIR/lvim"
LVIM_DEST="$HOME/.config/lvim"
if [ -d "$LVIM_SRC" ]; then
    echo "Linking lvim configuration..."
    rm -rf "$LVIM_DEST"  # Remove the existing directory/file if present
    ln -sf "$LVIM_SRC" "$LVIM_DEST"
else
    echo "Warning: $LVIM_SRC does not exist. Skipping lvim configuration."
fi

# Kitty configuration
KITTY_SRC="$DOT_DIR/kitty"
KITTY_DEST="$HOME/.config/kitty"
if [ -d "$KITTY_SRC" ]; then
    echo "Linking kitty configuration..."
    rm -rf "$KITTY_DEST"
    ln -sf "$KITTY_SRC" "$KITTY_DEST"
else
    echo "Warning: $KITTY_SRC does not exist. Skipping kitty configuration."
fi

# zsh configuration
ZSH_SRC="$DOT_DIR/zsh/.zshrc"
ZSH_DEST="$HOME/.zshrc"
if [ -f "$ZSH_SRC" ]; then
    echo "Linking zsh configuration..."
    rm -f "$ZSH_DEST"
    ln -sf "$ZSH_SRC" "$ZSH_DEST"
else
    echo "Warning: $ZSH_SRC does not exist. Skipping zsh configuration."
fi

echo "Configurations have been installed."
git.ajschof.me — hosted by ajschofield — powered by cgit