Skip to content

Commit 5d26c39

Browse files
committed
Add minimal setup
1 parent 3fc73a4 commit 5d26c39

8 files changed

Lines changed: 188 additions & 3 deletions

File tree

archlinux/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1111
)
1212

1313
# Download all packages using pacman for install/**/packages.txt (excluding the tilling since its optional)
14-
# find "$SCRIPT_DIR/install/" -path "$SCRIPT_DIR/install/tilling" -prune -o -name "packages.txt" -exec sh -c 'grep -v "^#" "$1" | sudo pacman -Sw --noconfirm --needed -' _ {} \;
14+
find "$SCRIPT_DIR/install/" -path "$SCRIPT_DIR/install/tilling" -prune -o -name "packages.txt" -exec sh -c 'grep -v "^#" "$1" | sudo pacman -S --noconfirm --needed -' _ {} \;
1515

1616
# Download all packages using yay for install/**/packages.aur.txt (excluding the tilling since its optional)
17-
# find "$SCRIPT_DIR/install/" -path "$SCRIPT_DIR/install/tilling" -prune -o -name "packages.aur.txt" -exec sh -c 'grep -v "^#" "$1" | yay -Sw --noconfirm --needed -' _ {} \;
17+
find "$SCRIPT_DIR/install/" -path "$SCRIPT_DIR/install/tilling" -prune -o -name "packages.aur.txt" -exec sh -c 'grep -v "^#" "$1" | yay -S --noconfirm --needed -' _ {} \;
1818

1919
# Force the script to be executed from its directory (since init.sh move us to /tmp during yay installation)
2020
cd "$SCRIPT_DIR" || exit

minimal/install/docker.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
3+
function setup(){
4+
echo "Configuring Docker..."
5+
6+
# Limit log size to avoid running out of disk
7+
sudo mkdir -p /etc/docker
8+
echo '{"log-driver":"json-file","log-opts":{"max-size":"10m","max-file":"5"}}' | sudo tee /etc/docker/daemon.json
9+
10+
# Start Docker automatically
11+
sudo systemctl enable docker
12+
13+
# Give this user privileged Docker access
14+
sudo usermod -aG docker ${USER}
15+
16+
# Prevent Docker from preventing boot for network-online.target
17+
sudo mkdir -p /etc/systemd/system/docker.service.d
18+
# Apply if not exist
19+
sudo tee /etc/systemd/system/docker.service.d/no-block-boot.conf <<'EOF'
20+
[Unit]
21+
DefaultDependencies=no
22+
EOF
23+
24+
sudo systemctl daemon-reload
25+
}
26+
27+
function check(){
28+
local has_error=0
29+
if ! docker info &> /dev/null; then
30+
show_error "Docker" "Docker is not running or not installed"
31+
has_error=1
32+
fi
33+
34+
if ! groups ${USER} | grep -q '\bdocker\b'; then
35+
show_error "Docker" "User ${USER} is not in the docker group"
36+
has_error=1
37+
fi
38+
39+
[ $has_error -eq 1 ] && return
40+
41+
show_success "Docker"
42+
}

minimal/install/keyboard.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function setup(){
2+
# Add the nuphy rules to /etc/udev/rules.d/99-nuphy.rules
3+
echo "Creating /etc/udev/rules.d/50-nuphy.rules..."
4+
sudo tee /etc/udev/rules.d/50-nuphy.rules >/dev/null <<'EOF'
5+
# NuPhy keyboards
6+
SUBSYSTEM=="usb", ATTR{idVendor}=="19f5", MODE="0666", GROUP="input"
7+
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="19f5", MODE="0666", GROUP="input"
8+
EOF
9+
10+
# Reload udev rules
11+
echo "Reloading udev rules..."
12+
sudo udevadm control --reload-rules
13+
sudo udevadm trigger
14+
}
15+
16+
function check(){
17+
# Check if the nuphy udev rules file exists
18+
if [ -f /etc/udev/rules.d/50-nuphy.rules ]; then
19+
show_success "NuPhy udev rules file exists"
20+
else
21+
show_error "NuPhy udev rules file" "The /etc/udev/rules.d/50-nuphy.rules file is missing."
22+
fi
23+
}

minimal/install/packages.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Development
2+
k9s
3+
kubectl
4+
mise
5+
mariadb-libs
6+
postgresql-libs
7+
8+
# Docker
9+
docker
10+
docker-compose
11+
docker-buildx
12+
lazydocker
13+
14+
# Video
15+
ffmpeg
16+
17+
# Git
18+
git
19+
lazygit
20+
21+
# Terminal Applications
22+
tldr
23+
fzf
24+
ripgrep
25+
zoxide
26+
bat
27+
jq
28+
xmlstarlet
29+
zip
30+
unzip
31+
curl
32+
wget
33+
unrar
34+
eza
35+
ncdu
36+
gum
37+
bash-completion
38+
btop
39+
fastfetch
40+
tmux
41+
yazi
42+
starship

minimal/install/ssh.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function setup(){
2+
grep -qxF 'net.ipv4.tcp_mtu_probing=1' /etc/sysctl.d/99-sysctl.conf || echo 'net.ipv4.tcp_mtu_probing=1' | sudo tee -a /etc/sysctl.d/99-sysctl.conf
3+
4+
# Enable Agent for the user
5+
systemctl --user enable --now ssh-agent.service
6+
}
7+
8+
function check(){
9+
local mtu_probing
10+
if ! mtu_probing=$(sysctl net.ipv4.tcp_mtu_probing 2>/dev/null | awk '{print $3}'); then
11+
show_error "SSH" "Warning: Failed to retrieve TCP MTU probing status."
12+
mtu_probing=0
13+
fi
14+
15+
if [ "$mtu_probing" == "1" ]; then
16+
show_success "SSH"
17+
else
18+
show_error "SSH" "TCP MTU probing is not enabled."
19+
fi
20+
21+
if systemctl --user is-active --quiet ssh-agent.service; then
22+
show_success "SSH Agent for user is activess"
23+
else
24+
show_error "SSH Agent" "ssh-agent.service is not active. Please enable it with: systemctl --user enable --now ssh-agent.service"
25+
fi
26+
}

minimal/install/systemd.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
function setup(){
2+
# Limit journal size to 50MB if not already set
3+
if ! grep -q "^SystemMaxUse=50M" /etc/systemd/journald.conf; then
4+
echo "SystemMaxUse=50M" | sudo tee -a /etc/systemd/journald.conf
5+
fi
6+
}
7+
8+
function check(){
9+
# Chck if the /etc/systemd/journald.conf exists
10+
if [ ! -f /etc/systemd/journald.conf ]; then
11+
show_warning "Systemd" "/etc/systemd/journald.conf does not exist."
12+
return
13+
fi
14+
15+
local journal_size
16+
journal_size=$(grep "^SystemMaxUse=" /etc/systemd/journald.conf | awk -F= '{print $2}' | tr -d '[:space:]')
17+
18+
if [ "$journal_size" != "50M" ]; then
19+
show_error "Systemd" "SystemMaxUse is not set to 50M in /etc/systemd/journald.conf"
20+
return
21+
fi
22+
23+
show_success "Systemd" "SystemMaxUse is set to 50M in /etc/systemd/journald.conf"
24+
}

minimal/setup.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
clear
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
# Force the script to be executed from its directory (since init.sh move us to /tmp during yay installation)
8+
cd "$SCRIPT_DIR" || exit
9+
10+
# Add local bin to PATH (since we installed binaries there)
11+
export PATH="$HOME/.local/bin:$PATH"
12+
13+
# Installation des scripts dans ~.local/bin
14+
mkdir -p ~/.local/bin
15+
cp "$SCRIPT_DIR/bin/"* ~/.local/bin/
16+
17+
# Download all packages using pacman for install/**/packages.txt (excluding the tilling since its optional)
18+
find "$SCRIPT_DIR/install/" -prune -o -name "packages.txt" -exec sh -c 'grep -v "^#" "$1" | sudo pacman -S --noconfirm --needed -' _ {} \;
19+
20+
# Source all script under install/system with confirmation
21+
if gum confirm "Do you want to run system setup scripts?"; then
22+
for script in "$SCRIPT_DIR/install/"*.sh; do
23+
(
24+
source "$script"
25+
setup
26+
)
27+
done
28+
fi

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -eE
1313
export PATH="$HOME/.local/bin:$PATH"
1414

1515
# Prompt with gum to choose the folder to setup.
16-
FOLDER=$(gum choose "archlinux" "macos" --header "Choose the setup you want to run:")
16+
FOLDER=$(gum choose "archlinux" "macos" "minimal" --header "Choose the setup you want to run :")
1717

1818
if [ -z "$FOLDER" ]; then
1919
echo "No folder selected. Exiting."

0 commit comments

Comments
 (0)