From 09388196a95805ca13b78133af79b0148ebb0e38 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Fri, 10 Jul 2026 08:30:51 +0100 Subject: [PATCH] feat(install): #59 NVIDIA commented system.nix guidance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- agent/BACKLOG.md | 9 --------- agent/JOURNAL.md | 12 ++++++++++++ docs/HARDWARE.md | 9 +++++---- pkgs/nomarchy-install/nomarchy-install.sh | 5 +++++ pkgs/nomarchy-install/patch-template.py | 16 +++++++++++++++- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/agent/BACKLOG.md b/agent/BACKLOG.md index dbc299f..aa6eabb 100644 --- a/agent/BACKLOG.md +++ b/agent/BACKLOG.md @@ -95,15 +95,6 @@ the Wi‑Fi card.” Does **not** rewrite the flake unless a later `--apply` is explicitly designed. Cost: extract script + package + man/README pointer; V0–V1. -### 59. Installer: NVIDIA commented system.nix guidance -Detection already adds `common-gpu-nvidia`; there is no -`nomarchy.hardware.nvidia.*` and hybrid/PRIME is wiki territory. When -NVIDIA is detected, emit a **commented** block in generated `system.nix` -(same style as ROCm/NPU) pointing at PRIME / powerManagement / -open-module and docs/HARDWARE.md §6 — not a full second stack. Cost: -install script strings; V0 + doc. Prefer this over first-class NVIDIA -options (`[big]` stays PROPOSED). - ### 60. Battery / powerprofile: name-agnostic battery scan `power.nix` oneshot and menu/waybar globs use `/sys/class/power_supply/BAT*`. `nomarchy-battery-notify` correctly diff --git a/agent/JOURNAL.md b/agent/JOURNAL.md index c5608bb..ff34492 100644 --- a/agent/JOURNAL.md +++ b/agent/JOURNAL.md @@ -17,6 +17,18 @@ Template: --- +## 2026-07-10 — #59 NVIDIA commented system.nix guidance +- **Task:** NEXT #59 — when `common-gpu-nvidia` is selected, emit + commented PRIME/power/open-module guidance in installer-generated + system.nix (ROCm/NPU pattern). +- **Did:** `has_nvidia` from HW_PROFILES → patch JSON; `build_installer_region` + emits comment-only plain NixOS block + HARDWARE.md §6 pointer. Docs §6 + product direction marked shipped. Closed #59. +- **Verified:** **V0** — patch-template smoke with nvidia true (region + contains hardware.nvidia.* comments + profile in flake); negative + (nvidia false) has neither; `bash -n` install script. +- **Next suggestion:** #60 BAT*-agnostic battery scan. + ## 2026-07-10 — #62 whole-swap CSS self-containment CI gate - **Task:** NEXT #62 — cheap gate that waybar.css defines every @color it references (would have caught neon-glass) + preview/backgrounds present. diff --git a/docs/HARDWARE.md b/docs/HARDWARE.md index 191a742..63baab9 100644 --- a/docs/HARDWARE.md +++ b/docs/HARDWARE.md @@ -228,10 +228,11 @@ force-load every GPU driver (avoids multi-driver panics). Proprietary NVIDIA on the live session is not the product focus; installed systems use the profile. -**Product direction (queued):** when detection selects -`common-gpu-nvidia`, emit a **commented** `system.nix` block with PRIME / -power / open-module pointers (same pattern as ROCm / NPU comments), not -a full second NVIDIA stack unless a maintainer commits to testing. +**Product direction (shipped #59):** when `common-gpu-nvidia` is in +`hardwareProfile`, the installer emits a **commented** `system.nix` block +with PRIME / power / open-module pointers (same pattern as ROCm / NPU +comments). A full `nomarchy.hardware.nvidia.*` stack stays optional and +needs a maintainer + hardware-queue coverage. ## 7. Day-2: “my laptop is mostly fine, make it fully fine” diff --git a/pkgs/nomarchy-install/nomarchy-install.sh b/pkgs/nomarchy-install/nomarchy-install.sh index 5ad0391..b7ed0a6 100644 --- a/pkgs/nomarchy-install/nomarchy-install.sh +++ b/pkgs/nomarchy-install/nomarchy-install.sh @@ -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" < 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"])