feat(install): #59 NVIDIA commented system.nix guidance
Some checks failed
Check / eval (push) Has been cancelled

When hardwareProfile includes common-gpu-nvidia, emit a comment-only
plain NixOS block (PRIME / powerManagement / open-module) in the
installer region of system.nix — same pattern as ROCm/NPU opt-ins.
HARDWARE.md §6 product direction marked shipped. Close #59.

Verified: V0 (patch-template smoke + negative + bash -n).
This commit is contained in:
Bernardo Magri
2026-07-10 08:30:51 +01:00
parent f09042adbe
commit 09388196a9
5 changed files with 37 additions and 14 deletions

View File

@@ -411,6 +411,10 @@ if [[ ${#HW_NOMARCHY[@]} -gt 0 ]]; then
esac
done
fi
# NVIDIA is a nixos-hardware MODULE only (no nomarchy.hardware.nvidia.*) —
# still emit commented plain-NixOS guidance in system.nix (BACKLOG #59).
has_nvidia=false
[[ " ${HW_PROFILES[*]:-} " == *" common-gpu-nvidia "* ]] && has_nvidia=true
is_laptop=false
[[ " ${HW_PROFILES[*]:-} " == *" common-pc-laptop "* ]] && is_laptop=true
thermald=false
@@ -452,6 +456,7 @@ python3 "$SHARE/patch-template.py" "$FLAKE_DIR" <<PYJSON
"amd": $has_amd,
"fingerprint": $has_fp,
"cameraIr": $has_camera_ir,
"nvidia": $has_nvidia,
"npu": $(if [[ -n "$NPU_VENDOR" ]]; then printf '%s' "$NPU_VENDOR" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read().rstrip("\n")))'; else echo null; fi)
},
"resumeOffset": $resume_json,

View File

@@ -117,7 +117,10 @@ def build_installer_region(v: dict) -> str:
)
hw = v.get("hardware") or {}
if any(hw.get(k) for k in ("intel", "amd", "fingerprint", "cameraIr", "npu")):
if any(
hw.get(k)
for k in ("intel", "amd", "fingerprint", "cameraIr", "npu", "nvidia")
):
lines.append(" # Hardware enablement (auto-detected).")
if hw.get("intel"):
lines.append(
@@ -151,6 +154,17 @@ def build_installer_region(v: dict) -> str:
f" # nomarchy.hardware.npu.enable = true; # {vendor} NPU (experimental; userspace BYO)",
" # nomarchy.hardware.latestKernel = true; # if the NPU driver needs a newer kernel",
]
# NVIDIA: profile is in flake.nix (common-gpu-nvidia). Hybrid/PRIME
# knobs are plain NixOS — comment-only guidance, same pattern as ROCm.
if hw.get("nvidia"):
lines += [
" # NVIDIA: common-gpu-nvidia is in hardwareProfile (flake.nix).",
" # Hybrid/PRIME, power, open-module — plain NixOS; see docs/HARDWARE.md §6",
" # and https://wiki.nixos.org/wiki/Nvidia (bus IDs are machine-specific).",
" # hardware.nvidia.prime = { ... }; # offload/sync",
" # hardware.nvidia.powerManagement.enable = true; # suspend/resume",
" # hardware.nvidia.open = false; # true = open module (newer cards)",
]
if v.get("resumeOffset") is not None:
root_uuid = nix_str(v["rootUuid"])