Last active
May 5, 2022 01:25
-
-
Save SamuelDavis/4e000dbfd879ce7d2d55a631b1868b8e to your computer and use it in GitHub Desktop.
Arch Linux installation/configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ~/.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
export BROWSER="brave-bin" | |
export _JAVA_AWT_WM_NONREPARENTING=1 # dwm support for phpstorm | |
export PATH="$PATH:$HOME/code/scripts" | |
alias ls='ls --color=auto' | |
git_url() { | |
URL=$(git config --get remote.origin.url) | |
URL=${URL#https://} | |
URL=${URL%.git} | |
[ -n "$URL" ] && echo "[$URL]" | |
} | |
git_branch() { | |
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) | |
[ -n "$BRANCH" ] && echo "[$BRANCH]"; | |
} | |
COLOR_RED='1;31'; | |
COLOR_GREEN='1;32'; | |
COLOR_YELLOW='1;33'; | |
COLOR_BLUE='1;34'; | |
COLOR_CYAN='1;36'; | |
COLOR_SILVER='1;37'; | |
function __IN_COLOR() { | |
COLOR="$1" | |
TEXT="${@:2}" | |
echo "\[\e[${COLOR}m\]${TEXT}\[\e[0m\]" | |
} | |
PS1='[\u@\[\e[${COLOR_SILVER}m\]\w\[\e[0m\]]' | |
PS1+='\[\e[${COLOR_CYAN}m\]$(git_url)\[\e[0m\]' | |
PS1+='\[\e[${COLOR_BLUE}m\]$(git_branch)\[\e[0m\]' | |
PS1+='$ ' | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax on | |
set nu | |
colorscheme slate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Increase Volume | |
"amixer --quiet -- sset Master playback 1%+" | |
XF86AudioRaiseVolume | |
# Decrease Volume | |
"amixer --quiet -- sset Master playback 1%-" | |
XF86AudioLowerVolume | |
# Mute Volume | |
"amixer --quiet -- sset Master toggle" | |
XF86AudioMute | |
# Mute Microphone | |
"amixer --quiet -- sset Capture toggle" | |
XF86AudioMicMute | |
# Backlight Brighten | |
"brightnessctl --quiet set 1%+" | |
XF86MonBrightnessUp | |
# Backlight Darken | |
"brightnessctl --quiet set 1%-" | |
XF86MonBrightnessDown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
userresources=$HOME/.Xresources | |
usermodmap=$HOME/.Xmodmap | |
sysresources=/etc/X11/xinit/.Xresources | |
sysmodmap=/etc/X11/xinit/.Xmodmap | |
# merge in defaults and keymaps | |
if [ -f $sysresources ]; then | |
xrdb -merge $sysresources | |
fi | |
if [ -f $sysmodmap ]; then | |
xmodmap $sysmodmap | |
fi | |
if [ -f "$userresources" ]; then | |
xrdb -merge "$userresources" | |
fi | |
if [ -f "$usermodmap" ]; then | |
xmodmap "$usermodmap" | |
fi | |
# start some nice programs | |
if [ -d /etc/X11/xinit/xinitrc.d ] ; then | |
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do | |
[ -x "$f" ] && . "$f" | |
done | |
unset f | |
fi | |
xrandr --output eDP-1 --mode 1680x1050 | |
xset r rate 200 25 | |
xbindkeys | |
feh --randomize --bg-fill ~/wallpapers | |
slstatus & exec dwm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* See LICENSE file for copyright and license details. */ | |
/* appearance */ | |
static const unsigned int borderpx = 1; /* border pixel of windows */ | |
static const unsigned int snap = 32; /* snap pixel */ | |
static const int showbar = 1; /* 0 means no bar */ | |
static const int topbar = 1; /* 0 means bottom bar */ | |
static const char *fonts[] = { "monospace:size=10" }; | |
static const char dmenufont[] = "monospace:size=10"; | |
static const char col_gray1[] = "#222222"; | |
static const char col_gray2[] = "#444444"; | |
static const char col_gray3[] = "#bbbbbb"; | |
static const char col_gray4[] = "#eeeeee"; | |
static const char col_cyan[] = "#005577"; | |
static const char col_gold[] = "#cea437"; | |
static const char col_brown[] = "#4c422a"; | |
static const char *colors[][3] = { | |
/* fg bg border */ | |
/*[SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, | |
[SchemeSel] = { col_gray4, col_cyan, col_cyan }, */ | |
[SchemeNorm] = { col_gray3, col_brown, col_brown }, | |
[SchemeSel] = { col_gold, col_brown, col_gold }, | |
}; | |
/* tagging */ | |
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; | |
static const Rule rules[] = { | |
/* xprop(1): | |
* WM_CLASS(STRING) = instance, class | |
* WM_NAME(STRING) = title | |
*/ | |
/* class instance title tags mask isfloating monitor */ | |
/*{ "Gimp", NULL, NULL, 0, 1, -1 }, | |
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },*/ | |
{}, | |
}; | |
/* layout(s) */ | |
static const float mfact = 0.60; /* factor of master area size [0.05..0.95] */ | |
static const int nmaster = 1; /* number of clients in master area */ | |
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */ | |
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ | |
static const Layout layouts[] = { | |
/* symbol arrange function */ | |
{ "[]=", tile }, /* first entry is default */ | |
{ "><>", NULL }, /* no layout function means floating behavior */ | |
{ "[M]", monocle }, | |
}; | |
/* key definitions */ | |
#define MODKEY Mod1Mask | |
#define TAGKEYS(KEY,TAG) \ | |
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ | |
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, | |
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ | |
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } | |
/* commands */ | |
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ | |
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; | |
static const char *termcmd[] = { "st", NULL }; | |
static const char MODCOMBO = MODKEY|ControlMask|ShiftMask; | |
static Key keys[] = { | |
/* modifier key function argument */ | |
// Bar | |
{ MODCOMBO, XK_b, togglebar, {0} }, | |
// Spawn | |
{ MODKEY, XK_space, spawn, {.v = dmenucmd } }, | |
{ MODCOMBO, XK_Return, spawn, {.v = termcmd } }, | |
// Quit | |
{ MODCOMBO, XK_c, killclient, {0} }, | |
// Exit | |
{ MODCOMBO, XK_Escape, quit, {0} }, | |
// Next/Previous Stack | |
{ MODCOMBO, XK_j, focusstack, {.i = +1 } }, | |
{ MODCOMBO, XK_k, focusstack, {.i = -1 } }, | |
// Focus/Toggle | |
{ MODKEY, XK_grave, zoom, {0} }, | |
{ MODKEY, XK_Tab, view, {0} }, | |
// Change Layout | |
{ MODCOMBO, XK_t, setlayout, {.v = &layouts[0]} }, | |
{ MODCOMBO, XK_f, setlayout, {.v = &layouts[2]} }, | |
{ MODCOMBO, XK_space, togglefloating, {0} }, | |
// Sizing | |
{ MODCOMBO, XK_h, setmfact, {.f = -0.05} }, | |
{ MODCOMBO, XK_l, setmfact, {.f = +0.05} }, | |
// Tagging | |
TAGKEYS( XK_1, 0) | |
TAGKEYS( XK_2, 1) | |
TAGKEYS( XK_3, 2) | |
TAGKEYS( XK_4, 3) | |
TAGKEYS( XK_5, 4) | |
TAGKEYS( XK_6, 5) | |
TAGKEYS( XK_7, 6) | |
TAGKEYS( XK_8, 7) | |
TAGKEYS( XK_9, 8) | |
/*{ MODKEY, XK_i, incnmaster, {.i = +1 } }, | |
{ MODKEY, XK_d, incnmaster, {.i = -1 } }, | |
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, | |
{ MODKEY, XK_space, setlayout, {0} }, | |
{ MODKEY, XK_0, view, {.ui = ~0 } }, | |
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, | |
{ MODKEY, XK_comma, focusmon, {.i = -1 } }, | |
{ MODKEY, XK_period, focusmon, {.i = +1 } }, | |
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, | |
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },*/ | |
}; | |
/* button definitions */ | |
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ | |
static Button buttons[] = { | |
/* click event mask button function argument */ | |
{ ClkLtSymbol, 0, Button1, setlayout, {0} }, | |
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, | |
{ ClkWinTitle, 0, Button2, zoom, {0} }, | |
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, | |
{ ClkClientWin, MODKEY, Button1, movemouse, {0} }, | |
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} }, | |
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, | |
{ ClkTagBar, 0, Button1, view, {0} }, | |
{ ClkTagBar, 0, Button3, toggleview, {0} }, | |
{ ClkTagBar, MODKEY, Button1, tag, {0} }, | |
{ ClkTagBar, MODKEY, Button3, toggletag, {0} }, | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pre-installation | |
# Internet access | |
################# | |
iwctl station list # list devices | |
NET_DEVICE="MyDevice" | |
iwctl station $NET_DEVICE scan | |
iwctl station $NET_DEVICE get-networks # list networks | |
NET_NAME="MyNetwork" | |
NET_PASS="MyPassword" | |
iwctl --passphrase $NET_PASS station $NET_DEVICE connect $NET_NAME | |
## Update Clock | |
############### | |
timedatectl set-ntp true | |
# Partition Disk | |
################ | |
fdisk -l # list disks | |
PART_DISK="/dev/mydisk" | |
fdisk $PART_DISK | |
# interactively: | |
# m: list help | |
# p: list partitions | |
# n: create new partition | |
# d: delete partition | |
# w: write partitions | |
# q: quit without writing partitions | |
PART_EFI="{$PART_DISK}p1" | |
PART_ROOT="{$PART_DISK}p5" | |
mkfs.ext4 $PART_ROOT # format the root partition | |
# Mount Filesystem | |
################## | |
mount $PART_ROOT /mnt | |
mkdir -p /mnt/boot | |
mount $PART_EFI /mnt/boot | |
################ | |
# Installation # | |
################ | |
pacstrap /mnt \ | |
base linux linux-firmware \ # base | |
reflector \ # updating pacman | |
alsa-firmware alsa-utils sof-firmware alsa-ucm-conf \ # sound | |
nvidia \ # video | |
brightnessctl \ # monitor brightness | |
networkmanager \ # internet | |
vim \ # editor | |
sudo \ # visudo for creating users | |
grub efibootmgr os-prober # bootloader | |
############# | |
# Configure # | |
############# | |
genfstab -U /mnt >> /mnt/etc/fstab | |
# Chroot | |
######## | |
arch-chroot /mnt | |
# Timezone | |
########## | |
ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime | |
hwclock --systohc | |
ENC="UTF-8" | |
LANG="en_US.$ENC" | |
echo "$LANG $ENC" >> /etc/locale.gen | |
locale-gen | |
echo "LANG=$LANG" >> /etc/locale.conf | |
# Networking | |
############ | |
HOSTNAME="MyHostname" | |
echo $HOSTNAME >> /etc/hostname | |
echo -e "127.0.0.1\tlocalhost" >> /etc/hosts | |
echo -e "::1\t\tlocalhost" >> /etc/hosts | |
echo -e "127.0.1.1\t${HOSTNAME}.localdomain\t${HOSTNAME}" >> /etc/hosts | |
# Root Password | |
############### | |
passwd | |
# Swap File | |
########### | |
SWAP_SIZE="4GB" | |
fallocate -l $SWAP_SIZE /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
echo "/swapfile none swap defaults 0 0" >> /etc/fstab | |
# Boot loader | |
############# | |
echo "GRUB_DISABLE_OS_PROBER=false" >> /etc/default/grub | |
grub-install \ | |
--target=x86_64-efi \ | |
--efi-directory=/boot \ | |
--bootloader-id=GRUB | |
grub-mkconfig -o /boot/grub/grub.cfg | |
# Background Services | |
##################### | |
systemctl enable NetworkManager | |
# Add User | |
###### | |
USERNAME="MyUsername" | |
useradd \ | |
--groups wheel \ | |
--create-home $USERNAME | |
passwd $USERNAME | |
EDITOR=vim visudo | |
# interactively | |
# uncomment %wheel ALL=(ALL) ALL | |
# Audio | |
####### | |
# cat /proc/asound/cards to list sound cards | |
echo -e "defaults.pcm.card 1\ndefaults.ctl.card 1" /etc/asound.conf | |
# unmute the master channel | |
alsamixer -c 0 | |
# To adjust volume limits, add the following to /etc/asound.conf | |
# pcm.!default { | |
# type plug | |
# slave.pcm "softvol" | |
# } | |
# | |
# pcm.softvol { | |
# type softvol | |
# slave { | |
# pcm "dmix" | |
# } | |
# control { | |
# name "Pre-Amp" | |
# card 0 | |
# } | |
# min_dB -5.0 | |
# max_dB 20.0 | |
# resolution 6 | |
# } | |
# Switch user | |
##################### | |
exit # exit installer | |
umount --all --lazy # unmount everything | |
reboot # restart the machine | |
# log into new user | |
# Media Keys | |
############ | |
sudo pacman --sync xbindkeys | |
# add the following to ~/.xbindkeysrc | |
# # Increase Volume | |
# "pactl set-sink-volume @DEFAULT_SINK@ +1000" | |
# XF86AudioRaiseVolume | |
# | |
# # Decrease Volume | |
# "pactl set-sink-volume @DEFAULT_SINK@ -1000" | |
# XF86AudioLowerVolume | |
# | |
# # Mute Volume | |
# "pactl set-sink-mute @DEFAULT_SINK@ toggle" | |
# XF86AudioMute | |
# | |
# # Mute Microphone | |
# "pactl set-source-mute @DEFAULT_SOURCE@ toggle" | |
# XF86AudioMicMute | |
# | |
# # Backlight Brighten | |
# "brightnessctl --quiet set 5%+" | |
# XF86MonBrightnessUp | |
# | |
# # Backlight Darken | |
# "brightnessctl --quiet set 5%-" | |
# XF86MonBrightnessDown | |
# Display Server | |
################ | |
sudo pacman --sync \ | |
git make base-devel linux-headers \ # tooling | |
ttf-liberation \ # fonts | |
xorg \ # dispay server | |
picom \ # compositor (fancy window animations) | |
feh \ # img viewer / bg manager | |
alacritty # terminal emulator | |
cp /etc/X11/xinit/xinitrc ~/.xinitrc | |
# User interface | |
################ | |
mkdir ~/aur | |
git clone https://git.suckless.org/dwm ~/aur/dwm | |
git clone https://git.suckless.org/dmenu ~/aur/dmenu | |
git clone https://git.suckless.org/slstatus ~/aur/slstatus | |
cd ~/aur/dwm && sudo make clean install | |
cd ~/aur/dmenu && sudo make clean install | |
cd ~/aur/st && sudo make clean install | |
cd ~/aur/slstatus && sudo make clean install | |
# replace xterm in ~/.xinitrc with... | |
# xset r rate 200 25 & # key repeat | |
# xrandr --output eDP-1 --mode 1680x1050 & # resolution | |
# xbindkeys & | |
# picom -f & | |
# slstatus -f & | |
# exec dwm | |
# add the following to autostart display server ~/.bash_profile | |
# if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then | |
# exec startx | |
# fi | |
# 1Password | |
########### | |
curl -sS https://downloads.1password.com/linux/keys/1password.asc | gpg --import # get GPG key | |
git clone https://aur.archlinux.org/1password.git ~/aur/1password | |
cd ~/aur/1password | |
makepkg --syncdeps --clean --install | |
# Browser | |
######### | |
git clone https://aur.archlinux.org/brave-bin.git ~/aur/brave-bin | |
cd ~/aur/brave-bin && makepkg --syncdeps --clean --install | |
# Docker | |
######## | |
sudo pacman --sync docker # install docker | |
sudo usermod --append $USER --groups docker # add user to docker group | |
sudo systemctl enable docker # enable docker daemon at startup | |
# SSH Key | |
######### | |
EMAIL="myemail@domain.tld" | |
SSH_ALGO="ed25519" | |
sudo pacman --sync openssh | |
ssh-keygen -t $SSH_ALGO -C $EMAIL | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_$SSH_ALGO | |
# PhpStorm | |
########## | |
echo "export _JAVA_AWT_VM_NONREPARENTING=1" >> ~/.bashrc # prevent UI rendering as gray square | |
git clone https://aur.archlinux.org/phpstorm.git ~/aur/phpstorm | |
cd ~/aur/phpstorm && makepkg -si | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* See LICENSE file for copyright and license details. */ | |
/* interval between updates (in ms) */ | |
const unsigned int interval = 1000; | |
/* text to show if no value can be retrieved */ | |
static const char unknown_str[] = "n/a"; | |
/* maximum output string length */ | |
#define MAXLEN 2048 | |
/* | |
* function description argument (example) | |
* | |
* battery_perc battery percentage battery name (BAT0) | |
* NULL on OpenBSD/FreeBSD | |
* battery_state battery charging state battery name (BAT0) | |
* NULL on OpenBSD/FreeBSD | |
* battery_remaining battery remaining HH:MM battery name (BAT0) | |
* NULL on OpenBSD/FreeBSD | |
* cpu_perc cpu usage in percent NULL | |
* cpu_freq cpu frequency in MHz NULL | |
* datetime date and time format string (%F %T) | |
* disk_free free disk space in GB mountpoint path (/) | |
* disk_perc disk usage in percent mountpoint path (/) | |
* disk_total total disk space in GB mountpoint path (/") | |
* disk_used used disk space in GB mountpoint path (/) | |
* entropy available entropy NULL | |
* gid GID of current user NULL | |
* hostname hostname NULL | |
* ipv4 IPv4 address interface name (eth0) | |
* ipv6 IPv6 address interface name (eth0) | |
* kernel_release `uname -r` NULL | |
* keyboard_indicators caps/num lock indicators format string (c?n?) | |
* see keyboard_indicators.c | |
* keymap layout (variant) of current NULL | |
* keymap | |
* load_avg load average NULL | |
* netspeed_rx receive network speed interface name (wlan0) | |
* netspeed_tx transfer network speed interface name (wlan0) | |
* num_files number of files in a directory path | |
* (/home/foo/Inbox/cur) | |
* ram_free free memory in GB NULL | |
* ram_perc memory usage in percent NULL | |
* ram_total total memory size in GB NULL | |
* ram_used used memory in GB NULL | |
* run_command custom shell command command (echo foo) | |
* separator string to echo NULL | |
* swap_free free swap in GB NULL | |
* swap_perc swap usage in percent NULL | |
* swap_total total swap size in GB NULL | |
* swap_used used swap in GB NULL | |
* temp temperature in degree celsius sensor file | |
* (/sys/class/thermal/...) | |
* NULL on OpenBSD | |
* thermal zone on FreeBSD | |
* (tz0, tz1, etc.) | |
* uid UID of current user NULL | |
* uptime system uptime NULL | |
* username username of current user NULL | |
* vol_perc OSS/ALSA volume in percent mixer file (/dev/mixer) | |
* NULL on OpenBSD | |
* wifi_perc WiFi signal in percent interface name (wlan0) | |
* wifi_essid WiFi ESSID interface name (wlan0) | |
*/ | |
static const struct arg args[] = { | |
/* function format argument */ | |
{ swap_perc,"%s%% swap | ",NULL }, | |
{ ram_perc,"%s%% ram | ",NULL }, | |
{ battery_perc,"%s%%","BAT0" }, | |
{ battery_state," bat%s | ","BAT0" }, | |
{ run_command,"%s%% vol | ","amixer -- sget Master playback | grep -oP '[0-9]+(?=%)'"}, | |
{ run_command,"%s%% scn | ","brightnessctl | grep -oP '[0-9]+(?=%)'"}, | |
{ datetime,"%s","%F %r" }, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment