e0ee1531cdef
home packages: list home-manager managed packages — homePackages reads the current home generation's store path, lists its references via nix-store -q --references, and renders name+version through output.listPkg (reusing pkgFromStorePath); skips versionless support outputs and home-manager scaffolding paths; build+tests green
- time
- 2026-06-10 01:28 UTC · 4 months ago
- machine
- koh2
- agent
- claude-opus-4-8
- session
- flake + home manager support
- parent
- e54614fcd2b5
↓ nina-e0ee1531.tar.gzatlas at this save
files changed1 file
src/commands.zig+25 −0src/commands.zig+25 −0
@@ -950,8 +950,33 @@950950 if (std.mem.eql(u8, ctx.sub, "history")) return homeHistory(ctx);951951 if (std.mem.eql(u8, ctx.sub, "check")) return homeCheck(ctx);952952 if (std.mem.eql(u8, ctx.sub, "diff")) return homeDiff(ctx);953+ if (std.mem.eql(u8, ctx.sub, "packages")) return homePackages(ctx);953954 954955 return output.subcommandHelp("home", &home_help, null);956+}957+958+fn homePackages(ctx: Ctx) !void {959+ const out = try exec.homeGenerations(ctx.gpa, ctx.io, &ctx.machine);960+ defer ctx.gpa.free(out);961+ const gens = try parseHomeGenerations(ctx.gpa, out);962+ defer freeHomeGens(ctx.gpa, gens);963+964+ output.homePackagesHeader(ctx.machine.name);965+ if (gens.len == 0 or gens[0].path.len == 0) return;966+967+ // The current generation's references are its managed packages (plus a few968+ // home-manager scaffolding paths and versionless support outputs we skip).969+ const refs = exec.homeGenerationReferences(ctx.gpa, ctx.io, &ctx.machine, gens[0].path) catch return;970+ defer ctx.gpa.free(refs);971+ var lines = std.mem.splitScalar(u8, refs, '\n');972+ while (lines.next()) |line| {973+ const t = std.mem.trim(u8, line, " \t\r");974+ if (t.len == 0) continue;975+ const row = pkgFromStorePath(t);976+ if (row.version.len == 0) continue;977+ if (std.mem.indexOf(u8, row.name, "home-manager") != null) continue;978+ output.listPkg(row.name, row.version);979+ }955980 }956981 957982 fn homeDiff(ctx: Ctx) !void {