feat: implement modular foundation and core system services
- Update flake.nix with 25.11 release and core inputs - Add dedicated modules for audio (Pipewire), bluetooth, and networking - Update GEMINI.md with the new Modular Merging Architecture blueprint - Configure graphical installer ISO and test VM outputs
This commit is contained in:
@@ -1,65 +1,44 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Toggle dedicated vs integrated GPU mode via supergfxd (for hybrid gpu laptops, like Asus G14).
|
||||
# Requires reboot to take effect.
|
||||
# Declarative enablement + Runtime mode switching for Nomarchy NixOS.
|
||||
|
||||
# Ensure supergfxctl has been installed
|
||||
if nomarchy-cmd-missing supergfxctl; then
|
||||
nomarchy-pkg-add supergfxctl
|
||||
FEATURE_FILE="/etc/nixos/nomarchy-features/supergfxd.nix"
|
||||
|
||||
# Create config before starting service to prevent hang on first boot
|
||||
sudo tee /etc/supergfxd.conf >/dev/null <<'CONF'
|
||||
if ! command -v supergfxctl &> /dev/null; then
|
||||
sudo mkdir -p "/etc/nixos/nomarchy-features"
|
||||
cat <<EOF | sudo tee "$FEATURE_FILE" > /dev/null
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
"mode": "Hybrid",
|
||||
"vfio_enable": true,
|
||||
"vfio_save": false,
|
||||
"always_reboot": false,
|
||||
"no_logind": false,
|
||||
"logout_timeout_s": 180,
|
||||
"hotplug_type": "None"
|
||||
services.supergfxd.enable = true;
|
||||
}
|
||||
CONF
|
||||
|
||||
sudo systemctl enable --now supergfxd
|
||||
EOF
|
||||
echo "Created $FEATURE_FILE to enable supergfxd."
|
||||
echo "IMPORTANT: To finish enabling hybrid GPU support, add './nomarchy-features/supergfxd.nix' to your imports list in /etc/nixos/system.nix or /etc/nixos/flake.nix,"
|
||||
echo "then run 'sys-update'."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
gpu_mode=$(supergfxctl -g)
|
||||
echo "Current GPU mode: $gpu_mode"
|
||||
|
||||
case "$gpu_mode" in
|
||||
"Integrated")
|
||||
if gum confirm "Enable dedicated GPU and reboot?"; then
|
||||
# Switch to hybrid mode
|
||||
sudo sed -i "s/\"mode\": \".*\"/\"mode\": \"Hybrid\"/" /etc/supergfxd.conf
|
||||
|
||||
# Let hybrid mode be the default after system sleep
|
||||
sudo rm -rf /usr/lib/systemd/system-sleep/force-igpu
|
||||
|
||||
# Remove the startup delay override (not needed for Hybrid mode)
|
||||
sudo rm -rf /etc/systemd/system/supergfxd.service.d/delay-start.conf
|
||||
|
||||
if gum confirm "Switch to Hybrid mode (enables dGPU) and reboot?"; then
|
||||
supergfxctl -m Hybrid
|
||||
echo "Switching to Hybrid mode..."
|
||||
nomarchy-system-reboot
|
||||
fi
|
||||
;;
|
||||
"Hybrid")
|
||||
if gum confirm "Use only integrated GPU and reboot?"; then
|
||||
# Switch to integrated mode and ensure vfio is enabled (needed for sleep/wake trick)
|
||||
sudo sed -i "s/\"mode\": \".*\"/\"mode\": \"Integrated\"/" /etc/supergfxd.conf
|
||||
sudo sed -i 's/"vfio_enable": false/"vfio_enable": true/' /etc/supergfxd.conf
|
||||
|
||||
# Force igpu mode after system sleep (or dgpu could get activated)
|
||||
sudo mkdir -p /usr/lib/systemd/system-sleep
|
||||
sudo cp -p $OMARCHY_PATH/default/systemd/system-sleep/force-igpu /usr/lib/systemd/system-sleep/
|
||||
|
||||
# Delay supergfxd startup to avoid race condition with display manager
|
||||
# that can cause system freeze when booting in Integrated mode
|
||||
sudo mkdir -p /etc/systemd/system/supergfxd.service.d
|
||||
sudo cp -p $OMARCHY_PATH/default/systemd/system/supergfxd.service.d/delay-start.conf /etc/systemd/system/supergfxd.service.d/
|
||||
|
||||
if gum confirm "Switch to Integrated mode (disables dGPU) and reboot?"; then
|
||||
supergfxctl -m Integrated
|
||||
echo "Switching to Integrated mode..."
|
||||
nomarchy-system-reboot
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Hybrid GPU not found or in unknown mode."
|
||||
echo "Hybrid GPU in unknown mode: $gpu_mode. Try 'supergfxctl -m Hybrid' manually."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user