feat(hw): #58 nomarchy-detect-hw post-install re-probe CLI
All checks were successful
Check / eval (push) Successful in 2m52s
All checks were successful
Check / eval (push) Successful in 2m52s
Package the installer’s pure hardware-db probe as nomarchy-detect-hw: prints suggested hardwareProfile and system.nix snippets (or --raw protocol lines). Does not rewrite the flake. On PATH via the distro module; docs/HARDWARE.md §8 updated. Close #58. Verified: V1 (build + run on AMD laptop with fingerprint/NPU/IR cam).
This commit is contained in:
@@ -77,15 +77,6 @@ last log lines + `nomarchy-doctor` instead of a raw Nix wall. Likely
|
|||||||
home: menu rebuild wrapper and/or control-center path. Cost: medium
|
home: menu rebuild wrapper and/or control-center path. Cost: medium
|
||||||
pkgs/menu; V1 + V2 smoke of the failure path (can force a bad eval).
|
pkgs/menu; V1 + V2 smoke of the failure path (can force a bad eval).
|
||||||
|
|
||||||
### 58. `nomarchy-detect-hw` CLI (post-install re-probe)
|
|
||||||
HARDWARE.md §8. Installer already has pure `nomarchy_detect_hw` stdout
|
|
||||||
protocol (MODULE / NOMARCHY / DETAIL). Ship it as a package on PATH that
|
|
||||||
prints suggested `hardwareProfile = [ … ]` and `system.nix` snippets
|
|
||||||
without reinstalling — closes the template/migration gap and “I swapped
|
|
||||||
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.
|
|
||||||
|
|
||||||
## LATER
|
## LATER
|
||||||
|
|
||||||
- **Wallpapers artifact split** (ROADMAP § Faster switches — decided,
|
- **Wallpapers artifact split** (ROADMAP § Faster switches — decided,
|
||||||
@@ -496,7 +487,8 @@ _(User password minimum length = 8 → #54.)_
|
|||||||
|
|
||||||
#### Live ISO discoverability (one durable cue)
|
#### Live ISO discoverability (one durable cue)
|
||||||
|
|
||||||
_(Live: one always-visible “Install Nomarchy” action → **#57**.)_
|
_(Live: one always-visible “Install Nomarchy” action → **#57** ✓ 2026-07-10;
|
||||||
|
V2 pending: live ISO desktop entry smoke.)_
|
||||||
|
|
||||||
#### Generated config / post-install polish
|
#### Generated config / post-install polish
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,16 @@ Template:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 2026-07-10 — #58 nomarchy-detect-hw CLI
|
||||||
|
- **Task:** NEXT #58 — post-install re-probe package (HARDWARE.md §8).
|
||||||
|
- **Did:** `pkgs/nomarchy-detect-hw` wrapping installer’s hardware-db;
|
||||||
|
human report + snippets + `--raw` protocol; overlay + systemPackages;
|
||||||
|
HARDWARE.md §8 updated. Closed #58.
|
||||||
|
- **Verified:** **V1** — package builds; ran on this AMD laptop: correct
|
||||||
|
MODULE/NOMARCHY lines (amd cpu/gpu, laptop, ssd, fingerprint, IR cam,
|
||||||
|
NPU) and printable system.nix snippets.
|
||||||
|
- **Next suggestion:** #55 fingerprint menu or #56 human rebuild errors.
|
||||||
|
|
||||||
## 2026-07-10 — #57 live Install Nomarchy affordance
|
## 2026-07-10 — #57 live Install Nomarchy affordance
|
||||||
- **Task:** NEXT #57 — durable live-ISO install surface (not only toast).
|
- **Task:** NEXT #57 — durable live-ISO install surface (not only toast).
|
||||||
- **Did:** `xdg.desktopEntries.nomarchy-install` (Terminal=true) on live
|
- **Did:** `xdg.desktopEntries.nomarchy-install` (Terminal=true) on live
|
||||||
|
|||||||
@@ -296,15 +296,15 @@ exist in a named nixos-hardware module.
|
|||||||
|
|
||||||
See [MIGRATION.md](MIGRATION.md): reuse `hardware-configuration.nix`, set
|
See [MIGRATION.md](MIGRATION.md): reuse `hardware-configuration.nix`, set
|
||||||
`hardwareProfile`, uncomment `nomarchy.hardware` / power in `system.nix`.
|
`hardwareProfile`, uncomment `nomarchy.hardware` / power in `system.nix`.
|
||||||
There is **no** post-install re-probe helper yet (queued as
|
Post-install re-probe (**shipped #58**):
|
||||||
`nomarchy-detect-hw`).
|
|
||||||
|
|
||||||
### Re-detect sketch (future)
|
```sh
|
||||||
|
nomarchy-detect-hw # human report + suggested snippets
|
||||||
|
nomarchy-detect-hw --raw # MODULE / NOMARCHY / DETAIL protocol lines
|
||||||
|
```
|
||||||
|
|
||||||
The installer’s `nomarchy_detect_hw` is already a pure probe (stdout
|
Prints suggested `hardwareProfile` and `system.nix` lines; **does not**
|
||||||
lines only). Exposing it as a package on PATH that prints suggested
|
rewrite the flake. Paste after review, then `sudo nixos-rebuild switch`.
|
||||||
`hardwareProfile` + `system.nix` snippets would close the template gap
|
|
||||||
without reinstalling.
|
|
||||||
|
|
||||||
## 9. Adding your model to the distro
|
## 9. Adding your model to the distro
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
nomarchy-doctor = final.callPackage ./pkgs/nomarchy-doctor { };
|
nomarchy-doctor = final.callPackage ./pkgs/nomarchy-doctor { };
|
||||||
nomarchy-control-center = final.callPackage ./pkgs/nomarchy-control-center { };
|
nomarchy-control-center = final.callPackage ./pkgs/nomarchy-control-center { };
|
||||||
nomarchy-battery-notify = final.callPackage ./pkgs/nomarchy-battery-notify { };
|
nomarchy-battery-notify = final.callPackage ./pkgs/nomarchy-battery-notify { };
|
||||||
|
nomarchy-detect-hw = final.callPackage ./pkgs/nomarchy-detect-hw { };
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosModules.nomarchy = {
|
nixosModules.nomarchy = {
|
||||||
@@ -120,6 +121,7 @@
|
|||||||
nomarchy-doctor = pkgs.nomarchy-doctor;
|
nomarchy-doctor = pkgs.nomarchy-doctor;
|
||||||
nomarchy-control-center = pkgs.nomarchy-control-center;
|
nomarchy-control-center = pkgs.nomarchy-control-center;
|
||||||
nomarchy-battery-notify = pkgs.nomarchy-battery-notify;
|
nomarchy-battery-notify = pkgs.nomarchy-battery-notify;
|
||||||
|
nomarchy-detect-hw = pkgs.nomarchy-detect-hw;
|
||||||
default = pkgs.nomarchy-theme-sync;
|
default = pkgs.nomarchy-theme-sync;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ in
|
|||||||
nomarchy-theme-sync # provided by overlays.default
|
nomarchy-theme-sync # provided by overlays.default
|
||||||
nomarchy-doctor # read-only health check (System › Doctor)
|
nomarchy-doctor # read-only health check (System › Doctor)
|
||||||
nomarchy-control-center # TUI control center
|
nomarchy-control-center # TUI control center
|
||||||
|
nomarchy-detect-hw # post-install hardware re-probe (HARDWARE.md §8)
|
||||||
|
|
||||||
# Friendly wrappers for the two rebuild paths (README §3). Run as
|
# Friendly wrappers for the two rebuild paths (README §3). Run as
|
||||||
# your user: `nix flake update` must NOT run as root (libgit2
|
# your user: `nix flake update` must NOT run as root (libgit2
|
||||||
|
|||||||
43
pkgs/nomarchy-detect-hw/default.nix
Normal file
43
pkgs/nomarchy-detect-hw/default.nix
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Post-install hardware re-probe (BACKLOG #58 / HARDWARE.md §8).
|
||||||
|
# Same pure nomarchy_detect_hw protocol as the installer; prints suggested
|
||||||
|
# hardwareProfile + system.nix snippets. Never rewrites the flake.
|
||||||
|
{ lib
|
||||||
|
, stdenvNoCC
|
||||||
|
, makeWrapper
|
||||||
|
, bash
|
||||||
|
, coreutils
|
||||||
|
, pciutils
|
||||||
|
, usbutils
|
||||||
|
, util-linux
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
pname = "nomarchy-detect-hw";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
share=$out/share/nomarchy-detect-hw
|
||||||
|
install -Dm644 ${../nomarchy-install/hardware-db.sh} "$share/hardware-db.sh"
|
||||||
|
install -Dm755 nomarchy-detect-hw.sh $out/bin/nomarchy-detect-hw
|
||||||
|
patchShebangs $out/bin/nomarchy-detect-hw
|
||||||
|
|
||||||
|
wrapProgram $out/bin/nomarchy-detect-hw \
|
||||||
|
--prefix PATH : ${lib.makeBinPath [ bash coreutils pciutils usbutils util-linux ]} \
|
||||||
|
--set NOMARCHY_DETECT_HW_SHARE "$share"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Probe hardware and print Nomarchy hardwareProfile / system.nix suggestions";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
mainProgram = "nomarchy-detect-hw";
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
||||||
134
pkgs/nomarchy-detect-hw/nomarchy-detect-hw.sh
Normal file
134
pkgs/nomarchy-detect-hw/nomarchy-detect-hw.sh
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# nomarchy-detect-hw — post-install re-probe (BACKLOG #58 / HARDWARE.md §8).
|
||||||
|
#
|
||||||
|
# Runs the same pure nomarchy_detect_hw protocol as the installer and
|
||||||
|
# prints suggested hardwareProfile + system.nix snippets. Never rewrites
|
||||||
|
# the flake (no --apply).
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# nomarchy-detect-hw # human-readable report + snippets
|
||||||
|
# nomarchy-detect-hw --raw # MODULE / NOMARCHY / DETAIL lines only
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SHARE="${NOMARCHY_DETECT_HW_SHARE:?nomarchy-detect-hw: not run via the packaged wrapper}"
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
source "$SHARE/hardware-db.sh"
|
||||||
|
|
||||||
|
raw=false
|
||||||
|
case "${1:-}" in
|
||||||
|
--raw|-r) raw=true ;;
|
||||||
|
-h|--help)
|
||||||
|
cat <<'EOF'
|
||||||
|
Usage: nomarchy-detect-hw [--raw]
|
||||||
|
|
||||||
|
Probe this machine the same way the live installer does and print
|
||||||
|
suggested flake hardwareProfile and system.nix hardware lines.
|
||||||
|
|
||||||
|
--raw emit only MODULE / NOMARCHY / NOMARCHY-NPU / DETAIL lines
|
||||||
|
(installer protocol). Default is a human report + snippets.
|
||||||
|
|
||||||
|
Does not modify any files. Paste the snippets into ~/.nomarchy after review.
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
"") ;;
|
||||||
|
*)
|
||||||
|
echo "nomarchy-detect-hw: unknown option: $1 (try --help)" >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if $raw; then
|
||||||
|
nomarchy_detect_hw
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
profiles=()
|
||||||
|
nomarchy_lines=()
|
||||||
|
npu=""
|
||||||
|
details=()
|
||||||
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
case "$line" in
|
||||||
|
MODULE\ *) profiles+=("${line#MODULE }") ;;
|
||||||
|
NOMARCHY\ *) nomarchy_lines+=("${line#NOMARCHY }") ;;
|
||||||
|
NOMARCHY-NPU\ *) npu="${line#NOMARCHY-NPU }" ;;
|
||||||
|
DETAIL\ *) details+=("${line#DETAIL }") ;;
|
||||||
|
esac
|
||||||
|
done < <(nomarchy_detect_hw)
|
||||||
|
|
||||||
|
echo "nomarchy-detect-hw — suggestions for this machine"
|
||||||
|
echo "(read-only; paste into ~/.nomarchy after review)"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if ((${#details[@]})); then
|
||||||
|
echo "## Detected"
|
||||||
|
for d in "${details[@]}"; do
|
||||||
|
printf ' · %s\n' "$d"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "## flake.nix — hardwareProfile"
|
||||||
|
if ((${#profiles[@]})); then
|
||||||
|
echo " hardwareProfile = ["
|
||||||
|
for p in "${profiles[@]}"; do
|
||||||
|
printf ' "%s"\n' "$p"
|
||||||
|
done
|
||||||
|
echo " ];"
|
||||||
|
else
|
||||||
|
echo " # (no modules detected — leave hardwareProfile unset or null)"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "## system.nix — nomarchy.hardware / power (safe defaults active;"
|
||||||
|
echo "## heavier opt-ins stay commented, same as the installer)"
|
||||||
|
if ((${#profiles[@]})) && printf '%s\n' "${profiles[@]}" | grep -qx 'common-pc-laptop'; then
|
||||||
|
echo " nomarchy.system.power.laptop = true;"
|
||||||
|
echo " # nomarchy.system.power.batteryChargeLimit = 80;"
|
||||||
|
fi
|
||||||
|
for nm in "${nomarchy_lines[@]:-}"; do
|
||||||
|
case "$nm" in
|
||||||
|
hardware.intel.enable=true)
|
||||||
|
echo " nomarchy.hardware.intel.enable = true; # GuC/HuC (i915)"
|
||||||
|
echo " # nomarchy.hardware.intel.computeRuntime = true; # OpenCL/oneVPL (opt-in)"
|
||||||
|
;;
|
||||||
|
hardware.intel.guc=false)
|
||||||
|
echo " nomarchy.hardware.intel.guc = false; # xe driver → GuC default-on"
|
||||||
|
;;
|
||||||
|
hardware.amd.enable=true)
|
||||||
|
echo " nomarchy.hardware.amd.enable = true; # amd-pstate + VA-API"
|
||||||
|
echo " # nomarchy.hardware.amd.rocm.enable = true; # ROCm (multi-GB, opt-in)"
|
||||||
|
echo ' # nomarchy.hardware.amd.rocm.gfxOverride = ""; # e.g. "11.0.0" for unlisted iGPU'
|
||||||
|
;;
|
||||||
|
hardware.fingerprint.enable=true)
|
||||||
|
echo " nomarchy.hardware.fingerprint.enable = true; # fprintd (enroll: fprintd-enroll)"
|
||||||
|
echo " # nomarchy.hardware.fingerprint.pam = true; # login + sudo (opt-in)"
|
||||||
|
;;
|
||||||
|
hardware.camera.hideIrSensor=true)
|
||||||
|
echo " nomarchy.hardware.camera.hideIrSensor = true; # dual-sensor: hide IR node"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo " # (unmapped NOMARCHY line: $nm)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if [[ -n "$npu" ]]; then
|
||||||
|
echo " # nomarchy.hardware.npu.enable = true; # $npu NPU (experimental; userspace BYO)"
|
||||||
|
echo " # nomarchy.hardware.latestKernel = true; # if the NPU driver needs a newer kernel"
|
||||||
|
fi
|
||||||
|
if printf '%s\n' "${profiles[@]:-}" | grep -qx 'common-gpu-nvidia'; then
|
||||||
|
echo " # NVIDIA: common-gpu-nvidia is in hardwareProfile (flake.nix)."
|
||||||
|
echo " # Hybrid/PRIME, power, open-module — plain NixOS; see docs/HARDWARE.md §6"
|
||||||
|
echo " # hardware.nvidia.prime = { ... };"
|
||||||
|
echo " # hardware.nvidia.powerManagement.enable = true;"
|
||||||
|
echo " # hardware.nvidia.open = false; # or true on newer cards"
|
||||||
|
fi
|
||||||
|
if ((${#nomarchy_lines[@]} == 0)) && [[ -z "$npu" ]] \
|
||||||
|
&& ! printf '%s\n' "${profiles[@]:-}" | grep -qx 'common-gpu-nvidia' \
|
||||||
|
&& ! printf '%s\n' "${profiles[@]:-}" | grep -qx 'common-pc-laptop'; then
|
||||||
|
echo " # (no nomarchy.hardware lines suggested)"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "Apply with: sudo nixos-rebuild switch --flake \${NOMARCHY_PATH:-\$HOME/.nomarchy}#default"
|
||||||
|
echo "Docs: docs/HARDWARE.md §8"
|
||||||
Reference in New Issue
Block a user