a3e1e6fb62c2

config: auto-detect flake system, note on channel commands — commands.flakeSystem returns true when cfg.flake OR a live flake.nix is found in the config dir; nina channel now prints the flake note for detected (not just configured) flakes; flakeChannelNote reworded to ':: note: flake-based system — use nina flake update to update inputs'; build+tests green

time
2026-06-10 01:22 UTC · 4 months ago
machine
koh2
agent
claude-opus-4-8
session
flake + home manager support
parent
e917196e218f
2 files src/commands.zig+8 −1src/output.zig+1 −1
src/commands.zig+8 −1
@@ -30,6 +30,13 @@3030     user: bool,            // --user: operate on user (vs system) services3131 };3232 33+// A system is flake-managed when the config says so OR a flake.nix is present in34+// the config dir. Detection means a fresh channel user who points nina at a flake35+// dir gets the right behavior without editing config first.36+fn flakeSystem(ctx: Ctx) bool {37+    return ctx.cfg.flake or exec.configHasFlake(ctx.gpa, ctx.io, &ctx.machine);38+}39+3340 pub fn apply(ctx: Ctx) !void {3441     if (ctx.dry) {3542         output.applyDry(ctx.machine.name);@@ -1002,7 +1009,7 @@10021009 pub fn channel(ctx: Ctx) !void {10031010     if (ctx.sub.len == 0 or std.mem.eql(u8, ctx.sub, "help")) return output.subcommandHelp("channel", &channel_help, null);10041011     // On a flake-managed system, nix-channel operations generally don't apply.1005-    if (ctx.cfg.flake) output.flakeChannelNote();1012+    if (flakeSystem(ctx)) output.flakeChannelNote();10061013     if (std.mem.eql(u8, ctx.sub, "list")) {10071014         output.channelListHeader(ctx.machine.name);10081015         const chans = try exec.channelList(ctx.gpa, ctx.io, &ctx.machine);

view file

src/output.zig+1 −1
@@ -1022,7 +1022,7 @@10221022 // Shown before channel operations on a flake-managed system, where nix-channel10231023 // commands generally don't apply.10241024 pub fn flakeChannelNote() void {1025-    p("{s}{s}note: using a flake system — channel commands may not apply{s}\n", .{ hdr(), c(DIM), c(RESET) });1025+    p("{s}{s}note: flake-based system — use {s}nina flake update{s}{s} to update inputs{s}\n", .{ hdr(), c(DIM), c(CYAN), c(RESET), c(DIM), c(RESET) });10261026 }10271027 10281028 pub fn firstRunWritten(path: []const u8) void {

view file