feat(linux-packages): add Nix packages count

This commit is contained in:
utox39
2025-12-06 19:28:12 +01:00
parent 2dfcadf413
commit b9dc58fabe

View File

@@ -13,3 +13,18 @@ fn countFlatpaks(allocator: std.mem.Allocator) !usize {
return try std.fmt.parseInt(usize, result_trimmed, 10);
}
fn countNixPackages(allocator: std.mem.Allocator) !usize {
// nix-store --query --requisites /run/current-system | wc -l
const result = try std.process.Child.run(.{ .allocator = allocator, .argv = &[_][]const u8{
"sh",
"-c",
"nix-store --query --requisites /run/current-system | wc -l",
} });
const result_stdout = result.stdout;
const result_trimmed = std.mem.trim(u8, result_stdout, "\n");
defer allocator.free(result_stdout);
return try std.fmt.parseInt(usize, result_trimmed, 10);
}