1dc3b72b2db4

home edit: open home.nix in editor — homeEdit resolves ~/.config/home-manager/home.nix via exec.homeNixPath and opens it in cfg.editor; placed before the module redirect so it works in both standalone and module mode (the same path detection keys on); build+tests green

time
2026-06-10 01:27 UTC · 4 months ago
machine
koh2
agent
claude-opus-4-8
session
flake + home manager support
parent
be5e5b56ec22
1 file src/commands.zig+14 −0
src/commands.zig+14 −0
@@ -938,6 +938,8 @@938938     // apply is the only command meaningful in module mode (it redirects to939939     // `nina apply`); everything else needs the standalone home-manager CLI.940940     if (std.mem.eql(u8, ctx.sub, "apply")) return homeApply(ctx, mode);941+    // edit just opens the local home.nix — fine in module mode too.942+    if (std.mem.eql(u8, ctx.sub, "edit")) return homeEdit(ctx);941943 942944     if (mode == .module) {943945         output.homeModuleManaged();@@ -948,6 +950,18 @@948950     if (std.mem.eql(u8, ctx.sub, "history")) return homeHistory(ctx);949951 950952     return output.subcommandHelp("home", &home_help, null);953+}954+955+fn homeEdit(ctx: Ctx) !void {956+    // Standalone home config lives at ~/.config/home-manager/home.nix; the same957+    // path is what detection keys on for module mode, so it resolves for both.958+    const path = exec.homeNixPath(ctx.gpa, ctx.environ) orelse {959+        errors.error_info.setMessage("could not resolve ~/.config/home-manager/home.nix", .{});960+        return error.ConfigNotFound;961+    };962+    defer ctx.gpa.free(path);963+    output.homeEditOpen(path, ctx.cfg.editor);964+    _ = try exec.openEditor(ctx.io, ctx.gpa, ctx.cfg.editor, path, null);951965 }952966 953967 fn homeHistory(ctx: Ctx) !void {

view file