Add omarchy-doctor

This commit is contained in:
Ryan Hughes
2025-09-28 00:41:37 -04:00
parent 0b172dbef1
commit 57a977a51d
40 changed files with 1032 additions and 356 deletions

View File

@@ -1,2 +1,9 @@
# Turn on bluetooth by default
chrootable_systemctl_enable bluetooth.service
OMARCHY_DESCRIPTION="Enable Bluetooth Service"
omarchy_install() {
chrootable_systemctl_enable bluetooth.service
}
omarchy_verify() {
systemctl is-enabled bluetooth.service >/dev/null 2>&1 || add_error "Bluetooth service not enabled"
}

View File

@@ -1,5 +1,18 @@
# Install wifi drivers for 2013-2015 MacBooks using the BCM4360 chip
if lspci -nnv | grep -A2 "14e4:43a0" | grep -q "106b:"; then
OMARCHY_DESCRIPTION="Apple BCM4360 WiFi Driver"
should_run() {
lspci -nnv | grep -A2 "14e4:43a0" | grep -q "106b:"
}
omarchy_install() {
should_run || return 0
echo "Apple BCM4360 detected"
sudo pacman -S --noconfirm --needed broadcom-wl dkms linux-headers
fi
}
omarchy_verify() {
should_run || return 2
omarchy-pkg-present broadcom-wl || add_error "Broadcom wireless driver not installed"
}

View File

@@ -1,7 +1,23 @@
# Detect MacBook models that need SPI keyboard modules
if [[ "$(cat /sys/class/dmi/id/product_name 2>/dev/null)" =~ MacBook12,1|MacBookPro13,[123]|MacBookPro14,[123] ]]; then
echo "Detected MacBook with SPI keyboard"
OMARCHY_DESCRIPTION="MacBook SPI Keyboard Support"
should_run() {
[[ "$(cat /sys/class/dmi/id/product_name 2>/dev/null)" =~ MacBook12,1|MacBookPro13,[123]|MacBookPro14,[123] ]]
}
omarchy_install() {
should_run || return 0
echo "Detected MacBook with SPI keyboard"
sudo pacman -S --noconfirm --needed macbook12-spi-driver-dkms
echo "MODULES=(applespi intel_lpss_pci spi_pxa2xx_platform)" | sudo tee /etc/mkinitcpio.conf.d/macbook_spi_modules.conf >/dev/null
fi
}
omarchy_verify() {
should_run || return 2 # Return 2 to indicate "not applicable"
# Check if driver is installed
pacman -Q macbook12-spi-driver-dkms &>/dev/null || add_error "MacBook SPI driver not installed"
# Check if mkinitcpio config exists
[[ -f /etc/mkinitcpio.conf.d/macbook_spi_modules.conf ]] || add_error "MacBook SPI modules config missing"
}

View File

@@ -1,15 +1,23 @@
# Detect T2 MacBook models using PCI IDs
# Vendor: 106b (Apple), Device IDs: 1801 or 1802 (T2 Security Chip)
if lspci -nn | grep -q "106b:180[12]"; then
OMARCHY_DESCRIPTION="Apple T2 MacBook Support"
# Detect T2 MacBook models using PCI IDs: 106b:1801 or 106b:1802
should_run() {
lspci -nn | grep -q "106b:180[12]"
}
# Installation function
omarchy_install() {
should_run || return 0
echo "Detected MacBook with T2 chip. Installing support items..."
sudo pacman -S --noconfirm --needed \
linux-t2 \
linux-t2-headers \
apple-t2-audio-config \
apple-bcm-firmware \
t2fanrd \
tiny-dfr
linux-t2 \
linux-t2-headers \
apple-t2-audio-config \
apple-bcm-firmware \
t2fanrd \
tiny-dfr
echo "apple-bce" | sudo tee /etc/modules-load.d/t2.conf >/dev/null
@@ -20,9 +28,22 @@ if lspci -nn | grep -q "106b:180[12]"; then
options brcmfmac feature_disable=0x82000
EOF
sudo mkdir -p /etc/limine-entry-tool.d
cat <<EOF | sudo tee /etc/limine-entry-tool.d/t2-mac.conf >/dev/null
sudo mkdir -p /etc/limine-entry-tool.d
cat <<EOF | sudo tee /etc/limine-entry-tool.d/t2-mac.conf >/dev/null
# Generated by Omarchy installer for T2 Mac support
KERNEL_CMDLINE[default]+="intel_iommu=on iommu=pt pcie_ports=compat"
EOF
fi
}
# Verification function
omarchy_verify() {
should_run || return 2
pacman -Q linux-t2 &>/dev/null || add_error "T2 Linux kernel not installed"
# Check if config files exist
[[ -f /etc/modules-load.d/t2.conf ]] || add_error "T2 modules config missing"
[[ -f /etc/mkinitcpio.conf.d/apple-t2.conf ]] || add_error "T2 mkinitcpio config missing"
[[ -f /etc/modprobe.d/brcmfmac.conf ]] || add_error "T2 WiFi fix config missing"
[[ -f /etc/limine-entry-tool.d/t2-mac.conf ]] || add_error "T2 boot config missing"
}

View File

@@ -1,5 +1,18 @@
AMD_AUDIO_CARD=$(pactl list cards 2>/dev/null | grep -B20 "Family 17h/19h" | grep "Name: " | awk '{print $2}' || true)
OMARCHY_DESCRIPTION="Framework 13 AMD Audio Input Fix"
should_run() {
AMD_AUDIO_CARD=$(pactl list cards 2>/dev/null | grep -B20 "Family 17h/19h" | grep "Name: " | awk '{print $2}' || true)
[[ -n "$AMD_AUDIO_CARD" ]]
}
omarchy_install() {
should_run || return 0
if [[ -n $AMD_AUDIO_CARD ]]; then
pactl set-card-profile "$AMD_AUDIO_CARD" "HiFi (Mic1, Mic2, Speaker)" 2>/dev/null || true
fi
}
omarchy_verify() {
should_run || return 2
pactl list cards | grep -A10 "$AMD_AUDIO_CARD" | grep -q "Active Profile:" || add_error "AMD audio profile not configured"
}

View File

@@ -1,4 +1,16 @@
# Ensure that F-keys on Apple-like keyboards (such as Lofree Flow84) are always F-keys
if [[ ! -f /etc/modprobe.d/hid_apple.conf ]]; then
echo "options hid_apple fnmode=2" | sudo tee /etc/modprobe.d/hid_apple.conf
fi
OMARCHY_DESCRIPTION="Set F-keys as F-keys by default"
omarchy_install() {
# Ensure that F-keys on Apple-like keyboards (such as Lofree Flow84) are always F-keys
if [[ ! -f /etc/modprobe.d/hid_apple.conf ]]; then
echo "options hid_apple fnmode=2" | sudo tee /etc/modprobe.d/hid_apple.conf
fi
}
omarchy_verify() {
[[ -f /etc/modprobe.d/hid_apple.conf ]] || add_error "Apple HID config missing"
if [[ -f /etc/modprobe.d/hid_apple.conf ]]; then
grep -q "options hid_apple fnmode=2" /etc/modprobe.d/hid_apple.conf || add_error "F-key mode not configured"
fi
}

View File

@@ -1,2 +1,15 @@
# Disable shutting system down on power button to bind it to power menu afterwards
sudo sed -i 's/.*HandlePowerKey=.*/HandlePowerKey=ignore/' /etc/systemd/logind.conf
OMARCHY_DESCRIPTION="Disable power button"
omarchy_install() {
# Disable shutting system down on power button to bind it to power menu afterwards
sudo sed -i 's/.*HandlePowerKey=.*/HandlePowerKey=ignore/' /etc/systemd/logind.conf
}
omarchy_verify() {
[[ -f /etc/systemd/logind.conf ]] || add_error "Logind config missing"
# Check if power button is set to ignore
if [[ -f /etc/systemd/logind.conf ]]; then
grep -q "^HandlePowerKey=ignore" /etc/systemd/logind.conf || add_error "Power button not set to ignore"
fi
}

View File

@@ -1,11 +1,30 @@
# This installs hardware video acceleration for Intel GPUs
# Check if we have an Intel GPU at all
if INTEL_GPU=$(lspci | grep -iE 'vga|3d|display' | grep -i 'intel'); then
OMARCHY_DESCRIPTION="Setup Intel video acceleration"
should_run() {
INTEL_GPU=$(lspci | grep -iE 'vga|3d|display' | grep -i 'intel' || true)
[[ -n "$INTEL_GPU" ]]
}
omarchy_install() {
should_run || return 0
# HD Graphics and newer uses intel-media-driver
if [[ "${INTEL_GPU,,}" =~ "hd graphics"|"xe"|"iris" ]]; then
sudo pacman -S --needed --noconfirm intel-media-driver
sudo pacman -S --needed --noconfirm intel-media-driver
elif [[ "${INTEL_GPU,,}" =~ "gma" ]]; then
# Older generations from 2008 to ~2014-2017 use libva-intel-driver
sudo pacman -S --needed --noconfirm libva-intel-driver
# Older generations from 2008 to ~2014-2017 use libva-intel-driver
sudo pacman -S --needed --noconfirm libva-intel-driver
fi
fi
}
# Verification function
omarchy_verify() {
should_run || return 2
# Check if appropriate driver is installed
if [[ "${INTEL_GPU,,}" =~ "hd graphics"|"xe"|"iris" ]]; then
pacman -Q intel-media-driver &>/dev/null || add_error "Intel media driver not installed"
elif [[ "${INTEL_GPU,,}" =~ "gma" ]]; then
pacman -Q libva-intel-driver &>/dev/null || add_error "Intel VA-API driver not installed"
fi
}

View File

@@ -1,6 +1,14 @@
# Ensure iwd service will be started
sudo systemctl enable iwd.service
OMARCHY_DESCRIPTION="Network Config"
# Prevent systemd-networkd-wait-online timeout on boot
sudo systemctl disable systemd-networkd-wait-online.service
sudo systemctl mask systemd-networkd-wait-online.service
omarchy_install() {
sudo systemctl enable iwd.service
sudo systemctl disable systemd-networkd-wait-online.service
sudo systemctl mask systemd-networkd-wait-online.service
}
omarchy_verify() {
systemctl is-enabled iwd.service >/dev/null 2>&1 || add_error "IWD service not enabled"
systemctl is-enabled systemd-networkd-wait-online.service 2>&1 | grep -q "masked" || add_error "systemd-networkd-wait-online not masked"
}

View File

@@ -1,31 +1,28 @@
# ==============================================================================
# Hyprland NVIDIA Setup Script for Arch Linux
# ==============================================================================
# This script automates the installation and configuration of NVIDIA drivers
# for use with Hyprland on Arch Linux, following the official Hyprland wiki.
#
# Author: https://github.com/Kn0ax
#
# ==============================================================================
OMARCHY_DESCRIPTION="NVIDIA GPU Configuration"
should_run() {
NVIDIA_GPU=$(lspci | grep -i 'nvidia' || true)
[[ -n "$NVIDIA_GPU" ]]
}
omarchy_install() {
should_run || return 0
# --- GPU Detection ---
if [ -n "$(lspci | grep -i 'nvidia')" ]; then
# --- Driver Selection ---
# Turing (16xx, 20xx), Ampere (30xx), Ada (40xx), and newer recommend the open-source kernel modules
if echo "$(lspci | grep -i 'nvidia')" | grep -q -E "RTX [2-9][0-9]|GTX 16"; then
NVIDIA_DRIVER_PACKAGE="nvidia-open-dkms"
if echo "$NVIDIA_GPU" | grep -q -E "RTX [2-9][0-9]|GTX 16"; then
NVIDIA_DRIVER_PACKAGE="nvidia-open-dkms"
else
NVIDIA_DRIVER_PACKAGE="nvidia-dkms"
NVIDIA_DRIVER_PACKAGE="nvidia-dkms"
fi
# Check which kernel is installed and set appropriate headers package
KERNEL_HEADERS="linux-headers" # Default
if pacman -Q linux-zen &>/dev/null; then
KERNEL_HEADERS="linux-zen-headers"
KERNEL_HEADERS="linux-zen-headers"
elif pacman -Q linux-lts &>/dev/null; then
KERNEL_HEADERS="linux-lts-headers"
KERNEL_HEADERS="linux-lts-headers"
elif pacman -Q linux-hardened &>/dev/null; then
KERNEL_HEADERS="linux-hardened-headers"
KERNEL_HEADERS="linux-hardened-headers"
fi
# force package database refresh
@@ -67,9 +64,9 @@ if [ -n "$(lspci | grep -i 'nvidia')" ]; then
sudo mkinitcpio -P
# Add NVIDIA environment variables to hyprland.conf
HYPRLAND_CONF="$HOME/.config/hypr/hyprland.conf"
HYPRLAND_CONF="$HOME/.config/hypr/envs.conf"
if [ -f "$HYPRLAND_CONF" ]; then
cat >>"$HYPRLAND_CONF" <<'EOF'
cat >>"$HYPRLAND_CONF" <<'EOF'
# NVIDIA environment variables
env = NVD_BACKEND,direct
@@ -77,4 +74,22 @@ env = LIBVA_DRIVER_NAME,nvidia
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
EOF
fi
fi
}
omarchy_verify() {
should_run || return 2
pacman -Q nvidia-dkms &>/dev/null || pacman -Q nvidia-open-dkms &>/dev/null || add_error "NVIDIA driver not installed"
[[ -f /etc/modprobe.d/nvidia.conf ]] || add_error "NVIDIA modprobe config missing"
if [[ -f /etc/modprobe.d/nvidia.conf ]]; then
grep -q "options nvidia_drm modeset=1" /etc/modprobe.d/nvidia.conf || add_error "NVIDIA DRM modeset not enabled"
fi
grep -q "nvidia" /etc/mkinitcpio.conf || add_error "NVIDIA modules not in mkinitcpio.conf"
if [[ -f "$HOME/.config/hypr/hyprland.conf" ]]; then
grep -q "LIBVA_DRIVER_NAME,nvidia" "$HOME/.config/hypr/hyprland.conf" || add_error "NVIDIA env vars not in Hyprland config"
fi
}

View File

@@ -1,16 +1,32 @@
chrootable_systemctl_enable cups.service
OMARCHY_DESCRIPTION="Printer Config"
# Disable multicast dns in resolved. Avahi will provide this for better network printer discovery
sudo mkdir -p /etc/systemd/resolved.conf.d
echo -e "[Resolve]\nMulticastDNS=no" | sudo tee /etc/systemd/resolved.conf.d/10-disable-multicast.conf
chrootable_systemctl_enable avahi-daemon.service
omarchy_install() {
chrootable_systemctl_enable cups.service
# Enable mDNS resolution for .local domains
sudo sed -i 's/^hosts:.*/hosts: mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns/' /etc/nsswitch.conf
# Disable multicast dns in resolved. Avahi will provide this for better network printer discovery
sudo mkdir -p /etc/systemd/resolved.conf.d
echo -e "[Resolve]\nMulticastDNS=no" | sudo tee /etc/systemd/resolved.conf.d/10-disable-multicast.conf
chrootable_systemctl_enable avahi-daemon.service
# Enable automatically adding remote printers
if ! grep -q '^CreateRemotePrinters Yes' /etc/cups/cups-browsed.conf; then
echo 'CreateRemotePrinters Yes' | sudo tee -a /etc/cups/cups-browsed.conf
fi
# Enable mDNS resolution for .local domains
sudo sed -i 's/^hosts:.*/hosts: mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns/' /etc/nsswitch.conf
chrootable_systemctl_enable cups-browsed.service
# Enable automatically adding remote printers
if ! grep -q '^CreateRemotePrinters Yes' /etc/cups/cups-browsed.conf; then
echo 'CreateRemotePrinters Yes' | sudo tee -a /etc/cups/cups-browsed.conf
fi
chrootable_systemctl_enable cups-browsed.service
}
omarchy_verify() {
systemctl is-enabled cups.service >/dev/null 2>&1 || add_error "CUPS service not enabled"
systemctl is-enabled avahi-daemon.service >/dev/null 2>&1 || add_error "Avahi daemon not enabled"
systemctl is-enabled cups-browsed.service >/dev/null 2>&1 || add_error "CUPS browsed service not enabled"
[[ -f /etc/systemd/resolved.conf.d/10-disable-multicast.conf ]] || add_error "Multicast DNS config missing"
grep -q "mdns_minimal" /etc/nsswitch.conf || add_error "mDNS not configured in nsswitch.conf"
[[ -f /etc/cups/cups-browsed.conf ]] && grep -q '^CreateRemotePrinters Yes' /etc/cups/cups-browsed.conf || add_error "Remote printers not enabled in CUPS"
}

View File

@@ -1,33 +1,37 @@
# First check that wireless-regdb is there
if [ -f "/etc/conf.d/wireless-regdom" ]; then
unset WIRELESS_REGDOM
. /etc/conf.d/wireless-regdom
fi
OMARCHY_DESCRIPTION="Wireless Regdom"
# If the region is already set, we're done
if [ ! -n "${WIRELESS_REGDOM}" ]; then
# Get the current timezone
if [ -e "/etc/localtime" ]; then
TIMEZONE=$(readlink -f /etc/localtime)
TIMEZONE=${TIMEZONE#/usr/share/zoneinfo/}
omarchy_install() {
if [ -f "/etc/conf.d/wireless-regdom" ]; then
unset WIRELESS_REGDOM
. /etc/conf.d/wireless-regdom
fi
# Some timezones are formatted with the two letter country code at the start
COUNTRY="${TIMEZONE%%/*}"
if [ ! -n "${WIRELESS_REGDOM}" ]; then
if [ -e "/etc/localtime" ]; then
TIMEZONE=$(readlink -f /etc/localtime)
TIMEZONE=${TIMEZONE#/usr/share/zoneinfo/}
# If we don't have a two letter country, get it from the timezone table
if [[ ! "$COUNTRY" =~ ^[A-Z]{2}$ ]] && [ -f "/usr/share/zoneinfo/zone.tab" ]; then
COUNTRY=$(awk -v tz="$TIMEZONE" '$3 == tz {print $1; exit}' /usr/share/zoneinfo/zone.tab)
fi
COUNTRY="${TIMEZONE%%/*}"
# Check if we have a two letter country code
if [[ "$COUNTRY" =~ ^[A-Z]{2}$ ]]; then
# Append it to the wireless-regdom conf file that is used at boot
echo "WIRELESS_REGDOM=\"$COUNTRY\"" | sudo tee -a /etc/conf.d/wireless-regdom >/dev/null
if [[ ! "$COUNTRY" =~ ^[A-Z]{2}$ ]] && [ -f "/usr/share/zoneinfo/zone.tab" ]; then
COUNTRY=$(awk -v tz="$TIMEZONE" '$3 == tz {print $1; exit}' /usr/share/zoneinfo/zone.tab)
fi
# Also set it one off now
if command -v iw &>/dev/null; then
sudo iw reg set ${COUNTRY}
if [[ "$COUNTRY" =~ ^[A-Z]{2}$ ]]; then
echo "WIRELESS_REGDOM=\"$COUNTRY\"" | sudo tee -a /etc/conf.d/wireless-regdom >/dev/null
if command -v iw &>/dev/null; then
sudo iw reg set ${COUNTRY}
fi
fi
fi
fi
fi
}
omarchy_verify() {
[[ -f /etc/conf.d/wireless-regdom ]] || add_error "Wireless regdom config missing"
if [[ -f /etc/conf.d/wireless-regdom ]]; then
grep -q "^WIRELESS_REGDOM=" /etc/conf.d/wireless-regdom || add_error "Wireless regulatory domain not configured"
fi
}

View File

@@ -1,5 +1,16 @@
# Disable USB autosuspend to prevent peripheral disconnection issues
if [[ ! -f /etc/modprobe.d/disable-usb-autosuspend.conf ]]; then
echo "options usbcore autosuspend=-1" | sudo tee /etc/modprobe.d/disable-usb-autosuspend.conf
fi
OMARCHY_DESCRIPTION="USB Autosuspend"
omarchy_install() {
# Disable USB autosuspend to prevent peripheral disconnection issues
if [[ ! -f /etc/modprobe.d/disable-usb-autosuspend.conf ]]; then
echo "options usbcore autosuspend=-1" | sudo tee /etc/modprobe.d/disable-usb-autosuspend.conf
fi
}
omarchy_verify() {
[[ -f /etc/modprobe.d/disable-usb-autosuspend.conf ]] || add_error "USB autosuspend config missing"
if [[ -f /etc/modprobe.d/disable-usb-autosuspend.conf ]]; then
grep -q "options usbcore autosuspend=-1" /etc/modprobe.d/disable-usb-autosuspend.conf || add_error "USB autosuspend not disabled"
fi
}