Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed

Overview
https://deps.rs/repo/github/notashelf/microfetch

Microfetch

Stupidly simple, laughably fast fetch tool. Written in Rust for speed and ease of maintainability. Runs in a fraction of a millisecond and displays most of the nonsense you'd see posted on r/unixporn or other internet communities. Aims to replace fastfetch on my personal system, but probably not yours. Though, you are more than welcome to use it on your system: it's pretty fast...

latest demo

Features

  • Fast
  • Really fast
  • Minimal dependencies
  • Actually really fast
  • Cool NixOS logo (other, inferior, distros are not supported)
  • Reliable detection of following info:
    • Hostname/Username
    • Kernel
      • Name
      • Version
      • Architecture
    • Current shell (from $SHELL, trimmed if store path)
    • Current Desktop (DE/WM/Compositor and display backend)
    • Memory Usage/Total Memory
    • Storage Usage/Total Storage (for / only)
    • Shell Colors
  • Did I mention fast?

Motivation

Fastfetch, as its name indicates, a very fast fetch tool written in C, however, I am not interested in any of its additional features and I very much dislike the defaults. Microfetch is a fetch tool that you would normally write in Bash and put in your ~/.bashrc but actually really fast because it opts-out of all customization options provided by Fastfetch. Why? Because I can.

I cannot re-iterate it enough, Microfetch is annoyingly fast.

Benchmarks

Microfetch's performance is mostly hardware-dependant, however, the overall trend seems to be < 2ms on any modern (2015 and after) CPU. Below are the benchmarks with Hyperfine on my desktop system.

Command Mean [ms] Min [ms] Max [ms] Relative Written by raf?
microfetch 1.3 ± 0.0 1.3 1.4 1.00 yes
fastfetch 31.9 ± 0.8 30.8 33.8 24.08 ± 0.98 no
pfetch 254.2 ± 4.8 246.7 264.9 191.97 ± 7.10 no
neofetch 735.4 ± 9.5 721.1 752.8 555.48 ± 19.08 no

As far as I'm concerned, Microfetch is faster than almost every fetch tool there is. The only downside of using Rust is introducing more "bloated" dependency trees and increasing build times. The latter is easily mitigated with Nix's binary cache, though.

To benchmark individual functions, Criterion.rs is used. See Criterion's Getting Started Guide for details or just run cargo bench to benchmark all features of Microfetch.

Installation

Microfetch is packaged in nixpkgs. You can get it through the unstable channel for the time being. The Nix flake can also be used for bleeding-edge builds.

Non-Nix users will have to build Microfetch with cargo. It is not published anywhere but I imagine you can use cargo install --git to install it from source.

cargo install --git https://github.com/notashelf/microfetch.git

Microfetch is currently not available anywhere else. Though, does it really have to be?

Customizing

You can't.

Why?

Customization, of any kind, is expensive: I could try reading environment variables, parse command-line arguments or read a configuration file but all of those increment execution time and resource consumption by a lot.

Really?

To be fair, you can customize Microfetch by, well, patching it. It's not the best way per se, but it will be the only way that does not compromise on speed.

The Nix package allows passing patches in a streamlined manner by passing .overrideAttrs to the derivation.

Contributing

I will, mostly, reject feature additions. This is not to say you should avoid them altogether, as you might have a really good idea worth discussing but as a general rule of thumb consider talking to me before creating a feature PR.

Contributions that help improve performance in specific areas of Microfetch are welcome. Though, prepare to be bombarded with questions if your changes are large.

Hacking

A Nix flake is provided. nix develop to get started. Direnv users may simply run direnv allow to get started.

Non-nix users will need cargo and gcc installed on their system, see Cargo.toml for available release profiles.

Thanks

Huge thanks to everyone who took the time to make pull requests or nag me in person about current issues. To list a few, special thanks to:

Additionally a big thank you to everyone who used, talked about or criticized Microfetch. I might have missed your name here, but you have my thanks.

License

Microfetch is licensed under GPL3. See the license file for details.

You might also like...
A simple cli to clone projects and fetch all projects in a GitHub org..

stupid-git A simple cli to clone projects and update all projects. get all repository from GitHub clone all pull all with git stash Usage create sgit.

Fetch and extract HTML's title and description by given link.

extd Fetch and extract HTML's title and description by given link. Usage in Cargo.toml: [dependencies] extd = "0.1.4" Example use extd::extract_td; f

A tool to control the fan speed by monitoring the temperature of CPU via IPMI.

ipmi-fan-control A tool to control the fan speed by monitoring the temperature of CPU via IPMI. Why Our Dell R730 server's iDRAC is not works as expec

A toy example showing how to run Rust code in Python for speed and progress.

PoC: Integrating Rust in Python A toy example showing how to run Rust code in Python for speed and progress. Requirements Python 3.6+ Rust 1.44+ Cargo

The high-speed IAPWS-IF97 package in Rust with C and Python binding
The high-speed IAPWS-IF97 package in Rust with C and Python binding

SEUIF97 This is the Rust implementation of the high-speed IAPWS-IF97 package seuif97 with C and Python binding. It is suitable for computation-intensi

Parallel iteration of FASTA/FASTQ files, for when sequence order doesn't matter but speed does

Rust-parallelfastx A truly parallel parser for FASTA/FASTQ files. Principle The input file is memory-mapped then virtually split into N chunks. Each c

This CLI will help you improve your typing accuracy and speed
This CLI will help you improve your typing accuracy and speed

This CLI will help you improve your typing accuracy and speed! Improve your personal bests and look back on your previous records in a graph. All in the convenience of your own terminal!

High-Speed Memory Scanner & Analyzer with REST API.

memory-server High-Speed Memory Scanner & Analyzer with REST API. Usage iOS Jailbreaking of iphone is required. Place your PC and iphone in the same n

⚡🚀 Content Delivery Network written in Rustlang, optimized for speed and latency.
⚡🚀 Content Delivery Network written in Rustlang, optimized for speed and latency.

Supported Formats HTML Javscript Css Image PNG JPG JPEG GIF SVG Video MP4 WEBM FLV Audio OGG ACC MP3 Archives ZIP RAR Feeds & Data JSON YAML XML Docum

Comments
  • fix: changed memory calculation to parse meminfo

    fix: changed memory calculation to parse meminfo

    Parses /proc/meminfo into a hashmap (for convenience, I'm unsure if it cause performance losses to be honest), and changes the the memory calculation to what was discussed in discord (MemTotal - MemAvailable).

    opened by kossLAN 2
  • add benchmarking for individual functions

    add benchmarking for individual functions

    Added bench-marking for individual functions with Criterion.rs, which is way more accurate than just running the whole thing through hyperfine. Criterion uses gnuplot for plots, so that is added as a dev shell input.

    opened by bloxx12 0
  • perf: use nix::sys::utsname::uname for less syscalls

    perf: use nix::sys::utsname::uname for less syscalls

    Instead of reading multiple files to get the sysname, release, and machine name, use the nix::sys::utsname::uname function which sends a single uname syscall instead. This increases performance and portability.

    From my observations, there are ~10 less syscalls.

    opened by ErrorNoInternet 0
Owner
raf
Political Scientist, Open source advocate, high-level programmer. @NixOS hacker and nixpkgs contributor.
raf
A high-performance web-based geospatial visualization tool with an emphasis LEO satellites and lunar missions.

A high-performance web-based geospatial visualization tool with an emphasis LEO satellites and lunar missions. Written in Rust to target WebGPU, with WebGL2 backwards compatibility.

Shane B. 5 Dec 20, 2023
Macchina - A system information frontend, with an (unhealthy) emphasis on performance.

macchina Fast, minimal and customizable system information frontend. Linux • macOS • Windows • NetBSD • FreeBSD • OpenWrt • Android About macchina let

Macchina CLI 682 Jan 5, 2023
🌳 A lightning-fast system fetch tool made with Rust.

?? treefetch A lightning-fast minimalist system fetch tool made in Rust. Even faster than neofetch and pfetch. Made to practice my new Rust skills ??

Angelo-F 134 Dec 14, 2022
A system fetch tool for Linux, written in Rust.

fetchit A system fetch tool for Linux, written in Rust. fetchit is a simple system info tool, written in Rust, for Linux based operating systems. It o

Ruturaj Nanoti 26 Nov 21, 2022
A libadwaita/gtk4 app for editing NixOS configurations

NixOS Configuration Editor A simple NixOS configuration editor application built with libadwaita, GTK4, and Relm4. The goal of this project is to prov

Victor Fuentes 137 Dec 25, 2022
WIP GUI for NixOS documentation + configuration

nixos-druid Highly experimental GUI for NixOS. For now I expect to frequently make large changes and break stuff whenever I'm working on this. Screens

Sybrand Aarnoutse 6 Aug 23, 2022
Secure Boot for NixOS [maintainers=@blitz @raitobezarius @nikstur]

Lanzaboote: Secure Boot for NixOS This repository contains tooling for UEFI Secure Boot on NixOS. The goal is to make Secure Boot available from nixpk

Nix community projects 79 Jan 6, 2023
An anyrun plugin that lets you search NixOS options.

anyrun-nixos-options An anyrun plugin that lets you search NixOS options. how 2 build? nix build ... or cargo build optionally :) Configuration This p

Michał 4 Aug 24, 2023
skyfetch ☁️ a system information fetch written in rust

skyfetch ☁️ a system information fetch written in rust requirements cargo install with curl

leo. 31 Dec 15, 2022
Alternative to *fetch, uwuifies all stats.

owofetch-rs Alternative to *fetch, uwuifies all stats. Installation: Arch: AUR Other Linux distros: Either compile the source with cargo build --relea

nett_hier 6 Dec 26, 2022