f1282c9a5b31

edit: remove hardware subcommand, warn that hardware-configuration.nix is auto-generated

time
2026-06-15 12:28 UTC · 3 months ago
machine
koh2
agent
claude-opus-4-8
session
murazaki feedback fixes
parent
8787be42c8d9
2 files src/commands.zig+8 −0src/output.zig+7 −0
src/commands.zig+8 −0
@@ -837,6 +837,14 @@837837 }838838 839839 pub fn edit(ctx: Ctx) !void {840+    // `edit` is multi-word, so a bare positional ("hardware") arrives as ctx.sub.841+    // hardware-configuration.nix is generated by nixos-generate-config and warns842+    // against hand-editing — refuse rather than silently opening the wrong file.843+    if (std.mem.eql(u8, ctx.sub, "hardware")) {844+        output.editHardwareWarning();845+        return;846+    }847+840848     // --dir opens the whole config directory (for editors that work better with841849     // a folder open), as root so root-owned config trees like /etc/nixos work.842850     var open_dir = false;

view file

src/output.zig+7 −0
@@ -660,6 +660,13 @@660660     p("\n   {s}run nina check to validate before applying{s}\n", .{ c(DIM), c(RESET) });661661 }662662 663+// `nina edit hardware` is a mistake: hardware-configuration.nix is generated by664+// nixos-generate-config and warns against hand-editing. Refuse and redirect.665+pub fn editHardwareWarning() void {666+    p("\n   {s}warning: hardware-configuration.nix is auto-generated — do not edit directly{s}\n", .{ c(YELLOW), c(RESET) });667+    p("   {s}-> make hardware changes in configuration.nix instead{s}\n", .{ c(CYAN), c(RESET) });668+}669+663670 // --- Fmt ---664671 665672 pub fn fmtStart(path: []const u8) void {

view file