{"id":23384919,"url":"https://github.com/javiorfo/zig-syslinfo","last_synced_at":"2025-10-19T13:15:55.743Z","repository":{"id":269204379,"uuid":"897972650","full_name":"javiorfo/zig-syslinfo","owner":"javiorfo","description":"Linux sysinfo Zig library","archived":false,"fork":false,"pushed_at":"2025-01-27T19:12:13.000Z","size":42,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T01:02:41.290Z","etag":null,"topics":["linux","sysinfo","zig","zig-package"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/javiorfo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-03T15:06:25.000Z","updated_at":"2025-03-07T11:27:04.000Z","dependencies_parsed_at":"2025-01-25T21:23:00.975Z","dependency_job_id":"37e9928a-82fb-443f-8dfb-d272d8c1d842","html_url":"https://github.com/javiorfo/zig-syslinfo","commit_stats":null,"previous_names":["javiorfo/zig-syslinfo"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/javiorfo/zig-syslinfo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-syslinfo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-syslinfo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-syslinfo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-syslinfo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javiorfo","download_url":"https://codeload.github.com/javiorfo/zig-syslinfo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javiorfo%2Fzig-syslinfo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279818170,"owners_count":26231378,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-19T02:00:07.647Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","sysinfo","zig","zig-package"],"created_at":"2024-12-21T23:32:48.356Z","updated_at":"2025-10-19T13:15:55.738Z","avatar_url":"https://github.com/javiorfo.png","language":"Zig","readme":"# zig-syslinfo\n*Linux sysinfo Zig library*\n\n## Caveats\n- C libs dependencies: `asound`, `libnm`, `glib-2.0` \n- Required Zig version: **0.14.1**\n- This library has been developed on and for Linux following open source philosophy.\n\n## Usage\n```zig\nconst std = @import(\"std\");\nconst syslinfo = @import(\"syslinfo\");\n\npub fn main() !void {\n    // DISK\n    const disk = try syslinfo.disk.usage(\"/\");\n    std.debug.print(\"DISK free {d}\\n\", .{disk.free});\n    std.debug.print(\"DISK blocks {d}\\n\", .{disk.blocks});\n    std.debug.print(\"DISK files {d}\\n\", .{disk.files});\n    std.debug.print(\"DISK files free {d}\\n\", .{disk.files_free});\n    std.debug.print(\"DISK perc used {d:.2}%\\n\", .{try disk.percentageUsed()});\n\n    // CPU\n    const cpu = syslinfo.cpu;\n    const cpu_usage = try cpu.usage();\n    std.debug.print(\"CPU user {d}\\n\", .{cpu_usage.user});\n    std.debug.print(\"CPU nice {d}\\n\", .{cpu_usage.nice});\n    std.debug.print(\"CPU idle {d}\\n\", .{cpu_usage.idle});\n    std.debug.print(\"CPU system {d}\\n\", .{cpu_usage.system});\n    std.debug.print(\"CPU iowait {d}\\n\", .{cpu_usage.iowait});\n\n    const cpu_info = try cpu.info();\n    defer cpu_info.deinit();\n    std.debug.print(\"CPU vendor id {s}\\n\", .{cpu_info.vendor_id});\n    std.debug.print(\"CPU model {d}\\n\", .{cpu_info.model});\n    std.debug.print(\"CPU model name {s}\\n\", .{cpu_info.model_name});\n    std.debug.print(\"CPU microcode {s}\\n\", .{cpu_info.microcode});\n    std.debug.print(\"CPU cores {d}\\n\", .{cpu_info.cpu_cores});\n    std.debug.print(\"CPU family {d}\\n\", .{cpu_info.cpu_family});\n    std.debug.print(\"CPU cache size {s}\\n\", .{cpu_info.cache_size});\n    std.debug.print(\"CPU perc used {d:.2}%\\n\", .{try cpu.percentageUsed()});\n\n    // THERMAL\n    const thermal = syslinfo.thermal;\n    const thermal_info = try thermal.info();\n    std.debug.print(\"THERMAL zone0 {d}\\n\", .{thermal_info.zone0.?});\n    std.debug.print(\"THERMAL zone1 {d}\\n\", .{try thermal.getTemperatureFromZone(thermal.ZONE.one)});\n    std.debug.print(\"THERMAL zone2 {d}\\n\", .{try thermal.getTemperatureFromZoneId(2)});\n\n    // MEMORY\n    const memory = try syslinfo.memory.usage();\n    std.debug.print(\"MEM free {d}\\n\", .{memory.free});\n    std.debug.print(\"MEM total {d}\\n\", .{memory.total});\n    std.debug.print(\"MEM cached {d}\\n\", .{memory.cached});\n    std.debug.print(\"MEM buffers {d}\\n\", .{memory.buffers});\n    std.debug.print(\"MEM available {d}\\n\",.{ memory.available});\n    std.debug.print(\"MEM free swap {d}\\n\", .{memory.free_swap});\n    std.debug.print(\"MEM total swap {d}\\n\", .{memory.total_swap});\n    std.debug.print(\"MEM perc used {d:.2}%\\n\", .{try memory.percentageUsed()});\n\n    // VOLUME\n    const vol = try syslinfo.volume.state(.{}); // Receives a struct (default values are \"default\" and \"Master\")\n    std.debug.print(\"VOL card name {s}\\n\", .{vol.card_name});\n    std.debug.print(\"VOL volume {d}%\\n\", .{vol.volume});\n    std.debug.print(\"VOL minimum {d}\\n\", .{vol.min});\n    std.debug.print(\"VOL maximum {d}\\n\", .{vol.max});\n    std.debug.print(\"VOL is muted {b}\\n\", .{vol.muted});\n\n    // NETWORK\n    const net = try syslinfo.network.state();\n    std.debug.print(\"NET SSID {s}\\n\", .{net.?.SSID});\n    std.debug.print(\"NET SSID len {d}\\n\", .{net.?.SSID_len});\n    std.debug.print(\"NET IPv4 {s}\\n\", .{net.?.ipv4});\n    std.debug.print(\"NET IPv4 len {d}\\n\", .{net.?.ipv4_len});\n    std.debug.print(\"NET mask {d}\\n\", .{net.?.mask});\n    std.debug.print(\"NET signal strength {d}\\n\", .{net.?.signal_strength});\n    std.debug.print(\"NET connection speed {d}\\n\", .{net.?.connection_speed});\n    std.debug.print(\"NET connection type {d}\\n\", .{net.?.connection_type});\n}\n```\n\n## Installation\n#### In your `build.zig.zon`:\n```zig\n.dependencies = .{\n    .syslinfo = .{\n        .url = \"https://github.com/javiorfo/zig-syslinfo/archive/refs/heads/master.tar.gz\",            \n        // .hash = \"hash suggested\",\n        // the hash will be suggested by zig build\n    },\n}\n```\n\n#### In your `build.zig`:\n```zig\nconst dep = b.dependency(\"syslinfo\", .{\n    .target = target,\n    .optimize = optimize,\n});\nexe.root_module.addImport(\"syslinfo\", dep.module(\"syslinfo\"));\n\nexe.linkLibC();\nexe.linkSystemLibrary(\"asound\");\nexe.linkSystemLibrary(\"libnm\");\nexe.linkSystemLibrary(\"glib-2.0\");\n```\n\n---\n\n### Donate\n- **Bitcoin** [(QR)](https://raw.githubusercontent.com/javiorfo/img/master/crypto/bitcoin.png)  `1GqdJ63RDPE4eJKujHi166FAyigvHu5R7v`\n- [Paypal](https://www.paypal.com/donate/?hosted_button_id=FA7SGLSCT2H8G)\n","funding_links":["https://www.paypal.com/donate/?hosted_button_id=FA7SGLSCT2H8G"],"categories":["Libraries","Systems Programming"],"sub_categories":["Operating Systems"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaviorfo%2Fzig-syslinfo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaviorfo%2Fzig-syslinfo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaviorfo%2Fzig-syslinfo/lists"}