https://github.com/Phate6660/nixinfo
A lib crate for gathering system info such as cpu, distro, environment, kernel, etc in Rust.
https://github.com/Phate6660/nixinfo
information-retrieval lib linux rust
Last synced: 8 months ago
JSON representation
A lib crate for gathering system info such as cpu, distro, environment, kernel, etc in Rust.
- Host: GitHub
- URL: https://github.com/Phate6660/nixinfo
- Owner: Phate6660
- License: other
- Created: 2020-08-10T19:43:24.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-14T19:42:37.000Z (about 2 years ago)
- Last Synced: 2025-04-11T13:16:30.196Z (8 months ago)
- Topics: information-retrieval, lib, linux, rust
- Language: Rust
- Homepage:
- Size: 142 KB
- Stars: 48
- Watchers: 4
- Forks: 9
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust - Phate6660/nixinfo
- awesome-rust-cn - Phate6660/nixinfo
- fucking-awesome-rust - Phate6660/nixinfo - A lib crate for gathering system info such as cpu, distro, environment, kernel, etc. (Libraries / System)
- awesome-rust - Phate6660/nixinfo - A lib crate for gathering system info such as cpu, distro, environment, kernel, etc. (Libraries / System)
README
## nixinfo
A lib crate for gathering system info such as cpu, distro, environment, kernel, etc in Rust.
I may often be behind on updating the release on crates.io.
So if you want the latest and greatest, add:
`nixinfo = { git = "https://github.com/Phate6660/nixinfo" }`
To your dependencies section in `Cargo.toml`.
Otherwise add: `nixinfo = "0.3.2"` instead.
## Currently supported
- CPU model and temperature by thermal zones (Celsius)
+ `nixinfo::cpu()` -> `Result`
+ `nixinfo::temp()` -> `Result>`
* The tuple contains the device name and the temperature in that order
- Device name
+ `nixinfo::device()` -> `Result`
- Distro name
+ `nixinfo::distro()` -> `Result`
- Environment (e.g. DE or WM)
+ `nixinfo::environment()` -> `Result`
- env variables
+ `nixinfo::env("VARIABLE")` -> `Option`
- GPU info (requires `lspci` and `grep` to be installed for now until I find a pure rust solution)
+ `nixinfo::gpu()` -> `Result`
- Hostname
+ `nixinfo::hostname()` -> `Result`
- Kernel
+ `nixinfo::kernel()` -> `Result`
- Total memory in MBs
+ `nixinfo::memory_total()` -> `Result`
- Free memory in MBs
+ `nixinfo::memory_free()` -> `Result`
- Available memory in MBs
+ `nixinfo::memory_available()` -> `Result`
- Used memory in MBs
+ `nixinfo::memory_used()` -> `Result`
- Music info
+ Features for this:
* `music_mpd` for music info from mpd
* `music_playerctl` for music info from an MPRIS supporting program via `playerctl`
* Enable neither of the features to get an N/A message
+ `nixinfo::music()` -> `String`
- Package counts (managers supported are apk, apt, dnf, dpkg, eopkg, pacman, pip, portage, rpm, and xbps)
+ `nixinfo::packages("manager")` -> `Result`
- Terminal being used (unless tmux is used, in which case N/A will be outputted because reasons)
+ `nixnfo::terminal()` -> `Result`
- Uptime of device
+ `nixinfo::uptime()` -> `Result`
## TODO
- Get all package counts in pure Rust
+ apk
+ apt/dpkg
* explicitely installed
* ~~total installed~~
+ dnf
+ eopkg
+ flatpak
+ pacman
* explicitly installed
* ~~total installed~~
+ pip
+ ~~portage~~
* ~~explicitly installed~~
* ~~total installed~~
* rpm
* xbps
- ~~Get GPU in pure Rust~~
- Restructure code
- Support *BSD