mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-01-17 03:19:05 +01:00
Remove scripts
I have decided to dedicate this repository solely to my dotfiles, which for the most part should work on any GNU/Linux distribution, not just Arch Linux. Separating the scripts from the dots should make things a lot easier to manage.
This commit is contained in:
parent
0b22905072
commit
19184ac049
@ -1,103 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# The bootstrap script is meant to be ran on a local user account after
|
||||
# everything core system related is set up.
|
||||
|
||||
set -xe
|
||||
|
||||
# Change the working directory to the location of this script
|
||||
# Then, move up to the root directory of the git repo
|
||||
cd "$(dirname "$0")"
|
||||
cd ..
|
||||
|
||||
# Raise an error if either distro or environment is not present
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo 'Usage: sh ./path/to/bootstrap <distro> <environment>'
|
||||
echo 'Example: sh ./scripts/bootstrap arch bspwm'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Raise an error if the distro isn't either arch or fedora
|
||||
if ! [ "$1" == "arch" ] && ! [ "$1" == "fedora" ]; then
|
||||
echo 'Error: distro must either be "arch" or "fedora"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install common packages if tig isn't found (one of the common packages)
|
||||
if ! hash tig 2>/dev/null; then
|
||||
echo 'Installing common packages...'
|
||||
if [ "$1" == "arch" ]; then sudo pacman -Syu --needed --noconfirm - < ./packages/arch/common; fi
|
||||
if [ "$1" == "fedora" ]; then sudo dnf install $(cat ./packages/fedora/common) --assumeyes; fi
|
||||
|
||||
echo 'Stowing common dotfiles...'
|
||||
stow -S common --dir=dots --target="$HOME" --no-folding --verbose=2
|
||||
|
||||
echo 'Configuring common packages...'
|
||||
sh ./scripts/006-common
|
||||
fi
|
||||
|
||||
# If Arch Linux
|
||||
if [ "$1" == "arch" ]; then
|
||||
# Raise an error if given an invalid environment
|
||||
if ! [ "$2" == "plasma" ] && ! [ "$2" == "bspwm" ]; then
|
||||
echo 'Invalid environment specified. Must be either "plasma" or "bspwm"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install yay if it isn't found (needed for AUR and bspwm)
|
||||
if ! hash yay 2>/dev/null; then
|
||||
echo 'Installing yay...'
|
||||
git clone https://aur.archlinux.org/yay-bin.git
|
||||
cd yay-bin
|
||||
makepkg -si
|
||||
cd ..
|
||||
rm -r yay-bin
|
||||
fi
|
||||
|
||||
# Install plasma
|
||||
if [ "$2" == "plasma" ]; then
|
||||
echo 'Installing plasma packages...'
|
||||
sudo pacman -Syu --needed --noconfirm --ignore discover - < ./packages/arch/plasma
|
||||
|
||||
echo 'Plasma packages installed. Now configure it.'
|
||||
fi
|
||||
|
||||
# Install bspwm
|
||||
if [ "$2" == "bspwm" ]; then
|
||||
echo 'Installing bspwm packages...'
|
||||
sudo pacman -Syu --needed --noconfirm - < ./packages/arch/bspwm
|
||||
|
||||
echo 'Installing bspwm packages from AUR...'
|
||||
yay -S polybar rtv shotgun launch-cmd
|
||||
|
||||
echo 'Stowing bspwm dotfiles...'
|
||||
stow -S bspwm --dir=dots --target="$HOME" --no-folding --verbose=2
|
||||
|
||||
echo 'Bspwm installed and configured. Now startx.'
|
||||
fi
|
||||
fi
|
||||
|
||||
# If Fedora
|
||||
if [ "$1" == "fedora" ]; then
|
||||
# Raise an error if given an invalid environment
|
||||
if ! [ "$2" == "gnome" ] && ! [ "$2" == "xfce" ]; then
|
||||
echo 'Invalid environment specified. Must be either "gnome" or "xfce"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install gnome packages if requested
|
||||
if [ "$2" == "gnome" ]; then
|
||||
echo 'Installing gnome packages...'
|
||||
sudo dnf install $(cat ./packages/fedora/gnome) --assumeyes
|
||||
|
||||
echo 'Now that the gnome packages are installed, you must set it up manually.'
|
||||
fi
|
||||
|
||||
# Install xfce packages if requested
|
||||
if [ "$2" == "xfce" ]; then
|
||||
echo 'Installing xfce packages...'
|
||||
sudo dnf install $(cat ./packages/fedora/xfce) --assumeyes
|
||||
|
||||
echo 'Now that the xfce packages are installed, you must set it up manually.'
|
||||
fi
|
||||
fi
|
@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Common commands used to configure installed software.
|
||||
|
||||
set -xe
|
||||
|
||||
# Configure yarn
|
||||
if hash yarn 2>/dev/null; then
|
||||
echo 'Found yarn. Configuring it...'
|
||||
yarn config set prefix /usr/local
|
||||
yarn config set -- --emoji true
|
||||
fi
|
||||
|
||||
# Set up a rust toolchain
|
||||
if hash rustup 2>/dev/null; then
|
||||
echo 'Found rust. Configuring the default toolchain...'
|
||||
rustup install stable
|
||||
rustup default stable
|
||||
fi
|
||||
|
||||
# Start and enable docker
|
||||
if hash docker 2>/dev/null; then
|
||||
echo 'Found docker. Requesting administrative rights to configure the service...'
|
||||
sudo systemctl start docker.service
|
||||
sudo systemctl enable docker.service
|
||||
fi
|
||||
|
||||
# Install vim plugins and make the undo directory
|
||||
if hash vim 2>/dev/null; then
|
||||
echo 'Found vim. Making directory for global undo and installing plugins...'
|
||||
mkdir -p ~/.vim/undo
|
||||
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
|
||||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
# TODO: Prompt for confirmation before running this script
|
||||
vim +PlugInstall +qall
|
||||
fi
|
||||
|
||||
# https://github.com/masterkorp/openvpn-update-resolv-conf
|
||||
# Note that openresolv should already be installed by netctl.
|
||||
if hash openvpn 2>/dev/null; then
|
||||
echo 'Found openvpn. Downloading open-resolv-conf.sh...'
|
||||
sudo curl -fLo /etc/openvpn/update-resolv-conf.sh --create-dirs \
|
||||
https://raw.githubusercontent.com/masterkorp/openvpn-update-resolv-conf/master/update-resolv-conf.sh
|
||||
# TODO: Prompt for confirmation that the script is valid
|
||||
fi
|
||||
|
||||
# Add user dirs if they don't exist yet (Desktop, Downloads, etc.)
|
||||
if hash xdg-user-dirs-update 2>/dev/null; then
|
||||
echo 'Found xdg-user-dirs. Attempting to create directories...'
|
||||
xdg-user-dirs-update
|
||||
fi
|
@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script assumes you already have an active internet connection
|
||||
# (preferably through Ethernet).
|
||||
#
|
||||
# https://wiki.archlinux.org/index.php/Installation_guide
|
||||
|
||||
set -xe
|
||||
|
||||
# Sync the time with one online before doing anything
|
||||
timedatectl set-ntp true
|
||||
|
||||
# Make a DOS partition table with one primary ext4 partition and
|
||||
# enable boot for it. Then, create a primary swap partition with
|
||||
# the remaining disk space.
|
||||
parted /dev/sda mklabel msdos
|
||||
|
||||
parted /dev/sda mkpart primary ext4 1MiB 60GiB
|
||||
|
||||
parted /dev/sda set 1 boot on
|
||||
|
||||
parted /dev/sda mkpart primary linux-swap 60GiB 100%
|
||||
|
||||
# Format sda1 with ext4 and sda2 with swap
|
||||
mkfs -t ext4 /dev/sda1
|
||||
|
||||
mkswap /dev/sda2
|
||||
|
||||
# Enable the swap partition
|
||||
swapon /dev/sda2
|
||||
|
||||
# Mount the newly created file system (/dev/sda1) to /mnt.
|
||||
mount /dev/sda1 /mnt
|
@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Install the base packages to the mounted partition (the newly
|
||||
# created filesystem).
|
||||
#
|
||||
# We also install grub and fish since grub is the boot loader
|
||||
# and fish is the preferred shell.
|
||||
#
|
||||
# https://wiki.archlinux.org/index.php/Installation_guide
|
||||
|
||||
set -xe
|
||||
|
||||
pacstrap /mnt base base-devel grub fish
|
@ -1,61 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Once this script finishes, change the root password with passwd,
|
||||
# then unmount /mnt (with umount) and restart the system.
|
||||
#
|
||||
# https://wiki.archlinux.org/index.php/Installation_guide
|
||||
|
||||
set -xe
|
||||
|
||||
echo -n "Enter a hostname for this machine: "
|
||||
read HOSTNAME
|
||||
|
||||
# Generate the fstab file (so the filesystem is mounted on boot)
|
||||
genfstab -U /mnt > /mnt/etc/fstab
|
||||
|
||||
# Set the timezone
|
||||
arch-chroot /mnt ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
|
||||
|
||||
# Generate /etc/adjtime
|
||||
arch-chroot /mnt hwclock --systohc
|
||||
|
||||
# Set the hostname
|
||||
echo "$HOSTNAME" > /mnt/etc/hostname
|
||||
|
||||
# Configure the hosts file (if your system has a permanent IP address, use that instead of 127.0.1.1)
|
||||
echo "127.0.0.1 localhost" >> /mnt/etc/hosts
|
||||
echo "::1 localhost" >> /mnt/etc/hosts
|
||||
echo "127.0.1.1 $HOSTNAME.localdomain $HOSTNAME" >> /mnt/etc/hosts
|
||||
|
||||
# Set the language to English and use the en_US.UTF-8 locale.
|
||||
echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf
|
||||
echo "en_US.UTF-8 UTF-8" > /mnt/etc/locale.gen
|
||||
|
||||
# Generate the locale.
|
||||
arch-chroot /mnt locale-gen
|
||||
|
||||
# Explicitly set the keymap to US.
|
||||
echo "KEYMAP=us" > /mnt/etc/vconsole.conf
|
||||
|
||||
# Change the terminal font to a larger one (`latarcyrheb-sun32` is also an option)
|
||||
echo "FONT=ter-132n" >> /mnt/etc/vconsole.conf
|
||||
|
||||
# Install grub to the primary partition.
|
||||
arch-chroot /mnt grub-install /dev/sda
|
||||
|
||||
# Prevent the GRUB window from showing at boot, ideal for single OS machines (undo with chroot and mkconfig)
|
||||
sed -i '/GRUB_TIMEOUT/c\GRUB_TIMEOUT=0' /mnt/etc/default/grub
|
||||
|
||||
# This should make the startup process not output anything (not tested)
|
||||
sed -i '/GRUB_CMDLINE_LINUX_DEFAULT/c\GRUB_CMDLINE_LINUX_DEFAULT="quiet show_status=0 rd.udev.log-priority=3 loglevel=3"' /mnt/etc/default/grub
|
||||
|
||||
# Make the configuration file for grub.
|
||||
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
# Change the shell of the root account to fish.
|
||||
arch-chroot /mnt chsh -s /usr/bin/fish
|
||||
|
||||
# Save our hardware information with mkinitcpio. This creates
|
||||
# an initial ramdisk environment that allows us to boot the
|
||||
# Linux kernel.
|
||||
arch-chroot /mnt mkinitcpio -p linux
|
@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Common post-install system configuration that doesn't involve any
|
||||
# external packages (besides fish)
|
||||
#
|
||||
# https://wiki.archlinux.org/index.php/General_recommendations
|
||||
|
||||
set -xe
|
||||
|
||||
echo -n "Enter a username for the local account with administrative rights: "
|
||||
read USERNAME
|
||||
|
||||
# Start and enable the DHCP client daemon service
|
||||
systemctl start dhcpcd.service
|
||||
systemctl enable dhcpcd.service
|
||||
|
||||
# Set the timezone with systemd, and sync it periodically with a remote server
|
||||
timedatectl set-timezone America/New_York
|
||||
timedatectl set-ntp true
|
||||
|
||||
# Font settings (https://old.reddit.com/r/archlinux/comments/5r5ep8)
|
||||
ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d # Disable embedded bitmaps for all fonts
|
||||
ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d # Enable sub-pixel RGB rendering
|
||||
ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d # Enable the LCD filter (reduces color fringing)
|
||||
|
||||
# Change the systemd wait time from 90s to 30s, mitigating a potential hang at shutdown
|
||||
echo "DefaultTimeoutStartSec=30s" >> /etc/systemd/system.conf
|
||||
echo "DefaultTimeoutStopSec=30s" >> /etc/systemd/system.conf
|
||||
|
||||
# Enable colors in pacman by uncommenting the Color line.
|
||||
sed -i '/Color/s/^#//g' /etc/pacman.conf
|
||||
|
||||
# Give users in the wheel group permission to use sudo
|
||||
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
|
||||
|
||||
# Create a new user account with sudo privileges and the fish shell.
|
||||
arch-chroot /mnt useradd -m -g users -G wheel -s /usr/bin/fish "$USERNAME"
|
||||
|
||||
# Then, set the password equal to the username (change this later).
|
||||
echo "$USERNAME:$USERNAME" | chpasswd
|
Loading…
Reference in New Issue
Block a user