fix(qa): comprehensive out-of-the-box audit and repair
- Fix critical bash dynamic scoping bug in install.sh (Impermanence/Form Factor). - Polished Live ISO with auto-login and passwordless sudo. - Repurposed nomarchy-toggle-suspend to directly execute systemctl suspend. - Updated nomarchy-launch-wifi to use nmtui in alacritty. - Optimized nomarchy-welcome to avoid redundant rebuilds via --no-update flag. - Enabled nomarchy-welcome in Hyprland autostart. - Wrapped Live ISO-modifying steps in welcome wizard to prevent failures. - Removed obsolete hardware auto-detection from nomarchy-on-boot. - Hardened script doc generator against false-positive wildcard tokens. - Regenerated docs/SCRIPTS.md and updated docs/ROADMAP.md.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Launch the Nomarchy wifi controls (provided by the Impala TUI).
|
||||
# Launch the Nomarchy wifi controls (using nmtui).
|
||||
# Attempts to unblock the wifi service first in case it should be been blocked.
|
||||
|
||||
rfkill unblock wifi
|
||||
nomarchy-launch-or-focus-tui impala
|
||||
alacritty -e nmtui
|
||||
|
||||
@@ -263,12 +263,6 @@ show_setup_config_menu() {
|
||||
show_setup_system_menu() {
|
||||
local options=""
|
||||
|
||||
if [[ $NNOMARCHY_TOGGLE_SUSPEND == "false" ]]; then
|
||||
options="$options Enable Suspend"
|
||||
else
|
||||
options="$options Disable Suspend"
|
||||
fi
|
||||
|
||||
if nomarchy-hibernation-available; then
|
||||
options="$options\n Disable Hibernate"
|
||||
else
|
||||
@@ -276,7 +270,6 @@ show_setup_system_menu() {
|
||||
fi
|
||||
|
||||
case $(menu "System" "$options") in
|
||||
*Suspend*) nomarchy-toggle-suspend; back_to show_setup_system_menu ;;
|
||||
*"Enable Hibernate"*) present_terminal nomarchy-hibernation-setup ;;
|
||||
*"Disable Hibernate"*) present_terminal nomarchy-hibernation-remove ;;
|
||||
*) back_to show_setup_menu ;;
|
||||
@@ -341,7 +334,7 @@ show_system_menu() {
|
||||
case $(menu "System" "$options") in
|
||||
*Screensaver*) nomarchy-launch-screensaver force ;;
|
||||
*Lock*) nomarchy-lock-screen ;;
|
||||
*Suspend*) systemctl suspend ;;
|
||||
*Suspend*) nomarchy-toggle-suspend ;;
|
||||
*Hibernate*) systemctl hibernate ;;
|
||||
*Logout*) nomarchy-system-logout ;;
|
||||
*Restart*) nomarchy-system-reboot ;;
|
||||
|
||||
@@ -19,63 +19,6 @@ if nomarchy-hw-asus-rog; then
|
||||
nomarchy-theme-set-keyboard-asus-rog >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
# 3. Declarative hardware configuration check (nixos-hardware)
|
||||
# This part ensures that if we are on an installed system, the correct
|
||||
# nixos-hardware module is selected in the configuration.
|
||||
# Skip this in the Live ISO environment
|
||||
if [[ $USER == "nixos" ]] || [[ -f /etc/nixos/hosts/nomarchy-live.nix ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
HW_FILE="/etc/nixos/hardware-selection.nix"
|
||||
if [ -w "$HW_FILE" ]; then
|
||||
PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null || echo "Unknown")
|
||||
BOARD_NAME=$(cat /sys/class/dmi/id/board_name 2>/dev/null || echo "Unknown")
|
||||
CPU_VENDOR=$(lscpu | grep "Vendor ID" | awk '{print $3}')
|
||||
|
||||
NEW_HW_MODULES=""
|
||||
|
||||
if [[ "$CPU_VENDOR" == "AuthenticAMD" ]]; then
|
||||
NEW_HW_MODULES="inputs.nixos-hardware.nixosModules.common-cpu-amd"
|
||||
elif [[ "$CPU_VENDOR" == "GenuineIntel" ]]; then
|
||||
NEW_HW_MODULES="inputs.nixos-hardware.nixosModules.common-cpu-intel"
|
||||
fi
|
||||
|
||||
# Auto-detect specific known models for nixos-hardware
|
||||
if echo "$PRODUCT_NAME" | grep -qi "XPS 15 9500"; then
|
||||
NEW_HW_MODULES="$NEW_HW_MODULES\n inputs.nixos-hardware.nixosModules.dell-xps-15-9500"
|
||||
elif echo "$PRODUCT_NAME" | grep -qi "XPS 13"; then
|
||||
NEW_HW_MODULES="$NEW_HW_MODULES\n inputs.nixos-hardware.nixosModules.dell-xps-13-9300" # fallback example
|
||||
elif echo "$PRODUCT_NAME" | grep -qi "Framework Laptop 16"; then
|
||||
NEW_HW_MODULES="$NEW_HW_MODULES\n inputs.nixos-hardware.nixosModules.framework-16-7040-amd"
|
||||
elif echo "$PRODUCT_NAME" | grep -qi "Framework Laptop 13"; then
|
||||
NEW_HW_MODULES="$NEW_HW_MODULES\n inputs.nixos-hardware.nixosModules.framework-13-7040-amd"
|
||||
elif echo "$PRODUCT_NAME" | grep -qi "Surface"; then
|
||||
NEW_HW_MODULES="$NEW_HW_MODULES\n inputs.nixos-hardware.nixosModules.microsoft-surface-pro-8" # fallback example
|
||||
elif echo "$PRODUCT_NAME" | grep -qi "Zephyrus G14"; then
|
||||
NEW_HW_MODULES="$NEW_HW_MODULES\n inputs.nixos-hardware.nixosModules.asus-zephyrus-g14"
|
||||
elif echo "$PRODUCT_NAME" | grep -qi "ThinkPad X1 Carbon"; then
|
||||
NEW_HW_MODULES="$NEW_HW_MODULES\n inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-carbon-gen9"
|
||||
fi
|
||||
|
||||
# Check if the current HW file differs from our detection
|
||||
if [ -n "$NEW_HW_MODULES" ] && ! grep -q "common-cpu" "$HW_FILE"; then
|
||||
# This is a basic detection. We overwrite it if it's completely empty or missing common-cpu.
|
||||
# It's better to let the user know, or auto-apply. We'll auto-apply for a smooth experience.
|
||||
cat <<EOF > "$HW_FILE.tmp"
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
$NEW_HW_MODULES
|
||||
];
|
||||
}
|
||||
EOF
|
||||
if ! cmp -s "$HW_FILE" "$HW_FILE.tmp"; then
|
||||
mv "$HW_FILE.tmp" "$HW_FILE"
|
||||
# We notify the user instead of running sys-update silently, as it requires root and time.
|
||||
notify-send -u normal "Hardware Auto-Detection" "New hardware profile detected. Please run 'sys-update' when ready."
|
||||
else
|
||||
rm "$HW_FILE.tmp"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# 3. Hardware detection
|
||||
# Superseded by the installer's hardware-db.sh and declarative selection.
|
||||
exit 0
|
||||
|
||||
@@ -28,17 +28,28 @@ echo ""
|
||||
|
||||
# 1. Select initial theme
|
||||
echo "Step 1: Choose your starting theme"
|
||||
nomarchy-theme-set "$(nomarchy-theme-list | gum filter --placeholder 'Select a theme...')"
|
||||
nomarchy-theme-set "$(nomarchy-theme-list | gum filter --placeholder 'Select a theme...')" --no-update
|
||||
|
||||
# 2. Select initial font
|
||||
echo "Step 2: Choose your preferred font"
|
||||
nomarchy-font-set "$(nomarchy-font-list | gum filter --placeholder 'Select a font...')"
|
||||
nomarchy-font-set "$(nomarchy-font-list | gum filter --placeholder 'Select a font...')" --no-update
|
||||
|
||||
# 3. Select panel position
|
||||
echo "Step 3: Choose your preferred panel position"
|
||||
POSITION=$(gum choose "top" "bottom")
|
||||
nomarchy-state-write panelPosition "$POSITION"
|
||||
|
||||
# Skip system-modifying steps in the Live ISO environment
|
||||
if [[ "$USER" == "nixos" ]]; then
|
||||
echo ""
|
||||
echo "Live ISO detected. Skipping home.nix generation and git repo check."
|
||||
nomarchy-env-update
|
||||
nomarchy-state-write welcome_done true --type bool
|
||||
gum style --foreground 82 "Setup complete! Enjoy your Nomarchy experience."
|
||||
sleep 3
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 4. Starter home.nix
|
||||
echo ""
|
||||
echo "Step 4: Starter home.nix"
|
||||
@@ -83,6 +94,9 @@ if [ ! -d "/etc/nixos/.git" ]; then
|
||||
fi
|
||||
|
||||
# 6. Success
|
||||
echo ""
|
||||
echo "Applying all changes..."
|
||||
nomarchy-env-update
|
||||
nomarchy-state-write welcome_done true --type bool
|
||||
|
||||
# Remove legacy flag file if it exists
|
||||
|
||||
Reference in New Issue
Block a user