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:
Bernardo Magri
2026-05-01 20:03:04 +01:00
parent 39b1a9c1b3
commit 6411395d9f
13 changed files with 73 additions and 129 deletions

View File

@@ -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