0-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. #!/usr/bin/env bash
  2. # NAME: Install base system packages with hardware detection
  3. set -euo pipefail
  4. # Source common functions
  5. source "$(dirname "$0")/../common.sh" || {
  6. echo "[ERROR] Could not source common.sh" >&2
  7. exit 1
  8. }
  9. # Global variables for hardware detection
  10. MICROCODE=""
  11. GPU_PACKAGES=""
  12. check_requirements() {
  13. if ! command_exists paru; then
  14. log_error "paru not found. Install it first"
  15. exit 1
  16. fi
  17. }
  18. detect_hardware() {
  19. local cpu_vendor gpu_info
  20. cpu_vendor=$(lscpu | grep "Vendor ID" | awk '{print $3}')
  21. gpu_info=$(lspci | grep -i vga)
  22. log_info "Detected CPU: $cpu_vendor"
  23. log_info "Detected GPU: $gpu_info"
  24. # Determine microcode package
  25. case "$cpu_vendor" in
  26. "GenuineIntel")
  27. MICROCODE="intel-ucode"
  28. log_info "Using Intel microcode"
  29. ;;
  30. "AuthenticAMD")
  31. MICROCODE="amd-ucode"
  32. log_info "Using AMD microcode"
  33. ;;
  34. *)
  35. MICROCODE=""
  36. log_warn "Unknown CPU vendor, skipping microcode"
  37. ;;
  38. esac
  39. # Determine GPU drivers
  40. if echo "$gpu_info" | grep -qi "amd\|radeon"; then
  41. GPU_PACKAGES="xf86-video-amdgpu vulkan-radeon lib32-vulkan-radeon opencl-mesa lib32-opencl-mesa"
  42. log_info "Using AMD GPU drivers"
  43. elif echo "$gpu_info" | grep -qi "intel"; then
  44. GPU_PACKAGES="xf86-video-intel vulkan-intel lib32-vulkan-intel intel-media-driver"
  45. log_info "Using Intel GPU drivers"
  46. elif echo "$gpu_info" | grep -qi "nvidia"; then
  47. GPU_PACKAGES="nvidia nvidia-utils lib32-nvidia-utils nvidia-settings"
  48. log_info "Using NVIDIA drivers"
  49. else
  50. GPU_PACKAGES=""
  51. log_warn "Unknown GPU, using generic drivers"
  52. fi
  53. }
  54. install_base_system() {
  55. log_info "Installing system base packages"
  56. local base_packages="base base-devel sudo stow linux-cachyos linux-cachyos-headers linux-firmware efibootmgr efitools mkinitcpio grub systemd-boot-manager"
  57. if [[ -n "$MICROCODE" ]]; then
  58. base_packages="$base_packages $MICROCODE"
  59. fi
  60. paru -S --needed --overwrite="*" $base_packages
  61. }
  62. install_networking() {
  63. log_info "Installing networking packages"
  64. paru -S --needed \
  65. networkmanager networkmanager-openvpn network-manager-applet \
  66. dhclient dnsmasq iptables-nft iwd wpa_supplicant wireless-regdb \
  67. bluez-libs blueman openssh
  68. }
  69. install_audio_video() {
  70. log_info "Installing audio and video packages"
  71. paru -S --needed \
  72. pipewire pipewire-alsa pipewire-pulse wireplumber \
  73. pavucontrol alsa-firmware alsa-plugins alsa-utils \
  74. gst-libav gst-plugin-pipewire gst-plugins-bad gst-plugins-ugly \
  75. mpv ffmpegthumbnailer easyeffects lsp-plugins-lv2
  76. }
  77. install_fonts_themes() {
  78. log_info "Installing fonts and themes"
  79. paru -S --needed \
  80. adobe-source-han-sans-cn-fonts adobe-source-han-sans-jp-fonts \
  81. adobe-source-han-sans-kr-fonts adobe-source-serif-fonts \
  82. awesome-terminal-fonts inter-font noto-fonts noto-fonts-cjk noto-fonts-emoji \
  83. ttf-bitstream-vera ttf-dejavu ttf-fantasque-nerd ttf-fira-code ttf-fira-mono \
  84. ttf-fira-sans ttf-liberation ttf-linux-libertine \
  85. ttf-meslo-nerd ttf-opensans otf-libertinus \
  86. papirus-icon-theme
  87. }
  88. install_development() {
  89. log_info "Installing development tools"
  90. paru -S --needed \
  91. git git-lfs git-crypt github-cli lazygit \
  92. go go-task python python-defusedxml python-packaging \
  93. python-protobuf python-pynvim python-pywlroots lua luarocks \
  94. ccls cmake ninja neovim-nightly-bin
  95. }
  96. install_cli_utilities() {
  97. log_info "Installing CLI utilities"
  98. paru -S --needed \
  99. bat btop duf dysk dust eza fd fzf glances glow httpie ncdu \
  100. plocate ripgrep tealdeer the_silver_searcher tmux wget \
  101. xdg-user-dirs zoxide yazi yq zsh
  102. }
  103. install_window_managers() {
  104. log_info "Installing window managers and desktop environment"
  105. paru -S --needed \
  106. swaybg swayfx swayidle swaylock-effects waybar \
  107. wlogout wdisplays wl-clipboard
  108. }
  109. install_gui_applications() {
  110. log_info "Installing GUI applications"
  111. paru -S --needed \
  112. chromium zen-browser-bin \
  113. legcord-bin \
  114. obs-studio obsidian dbeaver \
  115. libreoffice-fresh kitty nemo nemo-fileroller
  116. }
  117. install_system_utilities() {
  118. log_info "Installing system utilities"
  119. paru -S --needed \
  120. brightnessctl cronie cups cups-pdf gamemode gvfs gvfs-afc gvfs-google \
  121. gvfs-gphoto2 gvfs-mtp gvfs-nfs gvfs-smb haveged hdparm less lvm2 \
  122. man-db man-pages meld modemmanager mtools mupdf netctl nss-mdns \
  123. ntfs-3g ntp nvme-cli opencl-mesa pacman-contrib pass pika-backup \
  124. pkgfile power-profiles-daemon pv reflector remmina rsync rtkit \
  125. samba seahorse sg3_utils smartmontools snapper solaar steam \
  126. steam-native-runtime syncthing localsend system-config-printer \
  127. transmission-qt ufw unrar unzip upower usb_modeswitch usbutils \
  128. vi vorta w3m which xdg-desktop-portal xdg-desktop-portal-gnome \
  129. xdg-desktop-portal-gtk xdg-desktop-portal-wlr yad zenity
  130. }
  131. install_gaming_graphics() {
  132. log_info "Installing gaming and graphics packages"
  133. local gaming_base="lib32-alsa-lib lib32-alsa-plugins lib32-gamemode lib32-libpulse lib32-mesa lib32-openal
  134. lib32-vkd3d lib32-vulkan-mesa-layers vkd3d vulkan-mesa-layers vulkan-tools vulkan-validation-layers
  135. wine protonup-qt"
  136. if [[ -n "$GPU_PACKAGES" ]]; then
  137. paru -S --needed $gaming_base $GPU_PACKAGES
  138. else
  139. paru -S --needed $gaming_base
  140. fi
  141. }
  142. install_hardware_support() {
  143. log_info "Installing hardware support"
  144. paru -S --needed \
  145. sof-firmware xf86-input-libinput xfsprogs \
  146. xorg-server xorg-xdpyinfo xorg-xhost xorg-xinit xorg-xinput \
  147. xorg-xkill xorg-xrandr xorg-xwayland
  148. }
  149. install_cloud_devops() {
  150. log_info "Installing cloud and DevOps tools"
  151. paru -S --needed \
  152. aws-cli \
  153. kubectl kubectx postgresql
  154. }
  155. install_document_tools() {
  156. log_info "Installing document and productivity tools"
  157. paru -S --needed \
  158. pandoc-cli texinfo wkhtmltopdf-bin zathura zathura-pdf-mupdf \
  159. swappy wf-recorder
  160. }
  161. install_security_tools() {
  162. log_info "Installing security tools"
  163. paru -S --needed \
  164. yubikey-manager-qt
  165. }
  166. install_misc_packages() {
  167. log_info "Installing miscellaneous packages"
  168. paru -S --needed \
  169. pyenv wimlib \
  170. slurp grim swaync gum nwg-look lxsession colordiff
  171. log_info "Updating tldr database"
  172. tldr --update
  173. }
  174. main() {
  175. init_script
  176. check_requirements
  177. detect_hardware
  178. install_base_system
  179. install_networking
  180. install_audio_video
  181. install_fonts_themes
  182. install_development
  183. install_cli_utilities
  184. install_window_managers
  185. install_gui_applications
  186. install_system_utilities
  187. install_gaming_graphics
  188. install_hardware_support
  189. install_cloud_devops
  190. install_document_tools
  191. install_security_tools
  192. install_misc_packages
  193. finish_script 0
  194. }
  195. main "$@"