Skip to content

Instantly share code, notes, and snippets.

@Speyll
Last active November 7, 2024 18:34
Show Gist options
  • Save Speyll/b2c46449fb9a9be44f07be3a81f01a2b to your computer and use it in GitHub Desktop.
Save Speyll/b2c46449fb9a9be44f07be3a81f01a2b to your computer and use it in GitHub Desktop.
Short, simple and easy to understand shell scripts to automate Void Linux post-installation with a wayland setup, you can play around with it as you see fit.
#!/bin/sh
# Void Linux Post-Installation Script for Wayland
# Author: Speyll
# Last-update: 19-10-2024
# Enable debugging output and exit on error
set -x
# Add multilib and nonfree repositories
sudo xbps-install -Sy void-repo-nonfree
# Update package lists and upgrade existing packages
sudo xbps-install -Syu
# Install GPU drivers
install_gpu_driver() {
gpu_driver=""
case "$(lspci | grep -E 'VGA|3D')" in
*Intel*) gpu_driver="mesa-dri intel-video-accel vulkan-loader mesa-vulkan-intel" ;;
*AMD*) gpu_driver="mesa-dri mesa-vaapi mesa-vdpau vulkan-loader mesa-vulkan-radeon" ;;
*NVIDIA*)gpu_driver="mesa-dri nvidia nvidia-libs-32bit" ;;
esac
for pkg in $gpu_driver; do
[ -n "$pkg" ] && sudo xbps-install -y "$pkg"
done
}
install_gpu_driver
# Install CPU microcode updates
if lspci | grep -q 'Intel'; then
sudo xbps-install -y intel-ucode
sudo xbps-reconfigure -f linux-$(uname -r)
fi
# Install other packages
install_core_packages() {
for pkg in git tmux wayland dbus dbus-glib curl elogind polkit polkit-gnome chrony \
xdg-utils xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-desktop-portal \
pipewire gstreamer1-pipewire libspa-bluetooth pavucontrol wlr-randr \
noto-fonts-emoji noto-fonts-cjk-sans noto-fonts-ttf nerd-fonts-symbols-ttf \
grim slurp wl-clipboard cliphist \
swayimg swaybg mpv mpvpaper ffmpeg yt-dlp \
fnott libnotify \
nnn unzip p7zip unrar xz pcmanfm-qt ffmpegthumbnailer lxqt-archiver gvfs-smb gvfs-afc gvfs-mtp udisks2 \
flavours breeze-gtk breeze-snow-cursor-theme breeze-icons \
qt5-wayland bluez \
labwc neovim foot Waybar wlsunset fuzzel brightnessctl bash-completion; do
sudo xbps-install -y "$pkg" || echo "Failed to install $pkg"
done
}
install_networking_packages() {
for pkg in fuse-sshfs lynx rsync wireguard; do
sudo xbps-install -y "$pkg"
done
}
install_flatpak_packages() {
sudo xbps-install -y flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub io.gitlab.librewolf-community
flatpak install flathub com.github.tchx84.Flatseal
}
install_flatpak_gaming() {
flatpak install flathub com.usebottles.bottles
flatpak install flathub org.freedesktop.Platform.VulkanLayer.MangoHud
flatpak install flathub org.freedesktop.Platform.VulkanLayer.gamescope
}
install_gaming_packages() {
for pkg in void-repo-multilib-nonfree \
libgcc-32bit libstdc++-32bit libdrm-32bit libglvnd-32bit wine wine-mono gamemode MangoHud gamescope; do
sudo xbps-install -y "$pkg"
done
sudo usermod -aG gamemode $USER
}
# !IMPORTANT! here you can select what gets installed and what not by commenting
install_core_packages
install_networking_packages
install_flatpak_packages
#install_flatpak_gaming
#install_gaming_packages
# Set up PipeWire
sudo ln -s /usr/share/applications/pipewire.desktop /etc/xdg/autostart/pipewire.desktop
sudo mkdir -p /etc/alsa/conf.d
sudo ln -s /usr/share/alsa/alsa.conf.d/50-pipewire.conf /etc/alsa/conf.d
sudo ln -s /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d
# Set up bluetooth autostart
sudo ln -s /etc/sv/bluetoothd /var/service/
# Set up chrony
sudo ln -s /etc/sv/chronyd /var/service/
# Set up polkitd
sudo ln -s /etc/sv/polkitd /var/service/
# Remove unused services (TTYs)
for tty in 3 4 5 6; do
sudo rm -rf /var/service/agetty-tty"$tty"
done
# Set up ACPI
sudo ln -s /etc/sv/acpid/ /var/service/
sudo sv enable acpid
sudo sv start acpid
# Improve font rendering
for conf in 11-lcdfilter-default.conf 10-sub-pixel-rgb.conf 10-hinting-slight.conf; do
sudo ln -s /etc/fonts/conf.avail/"$conf" /etc/fonts/conf.d
done
# Set up NetworkManager
sudo xbps-install -Sy NetworkManager dbus
if sudo sv status wpa_supplicant >/dev/null 2>&1; then
sudo sv stop wpa_supplicant
fi
sudo rm -rf /var/services/wpa_supplicant 2>/dev/null
sudo ln -s /etc/sv/dbus /var/service
sudo ln -s /etc/sv/NetworkManager /var/service
sudo sv start NetworkManager
# Clone and set up dotfiles
git clone https://github.com/speyll/dotfiles "$HOME/dotfiles"
cp -r "$HOME/dotfiles/."* "$HOME/"
rm -rf "$HOME/dotfiles"
chmod -R +X "$HOME/.local/bin" "$HOME/.local/share/applications" "$HOME/.config/autostart/" # Adjust permissions
ln -s "$HOME/.config/mimeapps.list" "$HOME/.local/share/applications/" # Create symbolic link for mimeapps.list
dash "$HOME/.local/share/fonts/git-fonts.sh" # Run the font installation script
# Add user to wheel group for sudo access
echo "%sudo ALL=(ALL:ALL) NOPASSWD: /usr/bin/halt, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/shutdown, /usr/bin/zzz, /usr/bin/ZZZ" | sudo tee -a /etc/sudoers.d/wheel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment