Compare commits

..

No commits in common. "3de8b5ef8e9bf9ad081fe143ab66158e09cee694" and "014c1a35f5ff40ca7ced5dc6e2c71bffcab0948b" have entirely different histories.

4 changed files with 28 additions and 67 deletions

BIN
.github/assets/demo.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -1,13 +1,7 @@
[package]
name = "microfetch"
description = "Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed"
version = "0.4.13"
edition = "2024"
authors = [ "NotAShelf <raf@notashelf.dev>" ]
rust-version = "1.90"
readme = "./docs/README.md"
repository = "https://github.com/notashelf/microfetch"
license = "GPL-3.0"
name = "microfetch"
version = "0.4.13"
edition = "2024"
[lib]
name = "microfetch_lib"

View file

@ -10,7 +10,7 @@
<p>Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed</p>
<br/>
<a href="#synopsis">Synopsis</a><br/>
<a href="#features">Features</a> | <a href="#motivation">Motivation</a> | <a href="#benchmarks">Benchmarks</a><br/>
<a href="#features">Features</a> | <a href="#motivation">Motivation</a><br/> | <a href="#benchmarks">Benchmarks</a><br/>
<a href="#installation">Installation</a>
<br/>
</div>
@ -27,13 +27,11 @@ communities. Aims to replace [fastfetch] on my personal system, but
on your system: it is pretty _[fast](#benchmarks)_...
<p align="center">
<br/>
<img
alt="latest demo"
src="./assets/demo.png"
width="800px"
src="./.github/assets/demo.png"
width="850px"
>
<br/>
</p>
## Features
@ -57,14 +55,10 @@ on your system: it is pretty _[fast](#benchmarks)_...
- Shell Colors
- Did I mention fast?
- Respects [`NO_COLOR` spec](https://no-color.org/)
- Funny [^2]
[^1]: With the Mold linker, which is enabled by default in the Flake package,
the binary size is roughly 350kb. That's nearly 20kb reduction in size :)
[^2]: I don't know how else to describe the (unhealthy) amount of handwritten
assembly that was written in order to make Microfetch faster.
## Motivation
[Rube-Goldmark Machine]: https://en.wikipedia.org/wiki/Rube_Goldberg_machine
@ -93,15 +87,14 @@ solve a technical problem. The "problem" Microfetch solves is entirely
self-imposed. On the matter of _size_, the project is written in Rust, which
comes at the cost of "bloated" dependency trees and the increased build times,
but we make an extended effort to keep the dependencies minimal and build times
manageable. The latter is also very easily mitigated with Nix's binary cache
managable. The latter is also very easily mitigated with Nix's binary cache
systems. Since Microfetch is already in Nixpkgs, you are recommended to use it
to utilize the binary cache properly. The usage of Rust _is_ nice, however,
since it provides us with incredible tooling and a very powerful language that
allows for Microfetch to be as fast as possible. ~~Sure C could've been used
here as well, but do you think I hate myself?~~ Microfetch now features
handwritten assembly to unsafely optimize some areas. In hindsight you all
should have seen this coming. Is it faster? Yes. Should you use this? If you
want to.
should have seen this coming. Is it faster? Yes.
Also see: [Rube-Goldmark Machine]
@ -135,19 +128,9 @@ up to date, but I will try to update the numbers as I make Microfetch faster.
The point stands that Microfetch is significantly faster than every other fetch
tool I have tried. This is to be expected, of course, since Microfetch is
designed _explicitly_ for speed and makes some tradeoffs to achieve its
designed _explicitly_ for speed and makes some tradeoffs to achieve it's
signature speed.
> [!IMPORTANT]
> Some tools are excluded. Yes, I know. If you think they are important and thus
> should be covered in the benchmarks, feel free to create an issue. The purpose
> of this benchmarks section is not to badmouth other projects, but to
> demonstrate how much faster Microfetch is in comparison. Obviously Microfetch
> is designed to be small (in the sense of scope) and fast (in every definition
> of the word) so I speak of Microfetch's speed as a fact rather than an
> advantage. Reddit has a surprising ability to twist words and misunderstand
> ideals.
### Benchmarking Individual Functions
[Criterion.rs]: https://github.com/bheisler/criterion.rs
@ -186,62 +169,46 @@ performance regressions.
## Installation
> [!NOTE]
> You will need a Nerd Fonts patched font installed, and for your terminal
> emulator to support said font. Microfetch uses Nerd Fonts glyphs by default,
> You will need a Nerdfonts patched font installed, and for your terminal
> emulator to support said font. Microfetch uses nerdfonts glyphs by default,
> but this can be changed by [patching the program](#customizing).
Microfetch is packaged in [nixpkgs](https://github.com/nixos/nixpkgs). It can be
installed by adding `pkgs.microfetch` to your `environment.systemPackages`.
Additionally, you can try out Microfetch in a Nix shell or install it using
flakes on non-NixOS systems.
Additionally, you can try out Microfetch in a Nix shell.
```bash
# Enter a Nix shell with Microfetch; this will be lost on the next GC
nix shell nixpkgs#microfetch
# Install Microfetch globally; this will be kept on GC
nix profile add nixpkgs#microfetch
```
Or run it directly with `nix run`
```bash
# Run Microfetch from Nixpkgs. Subsequent runs will be faster.
nix run nixpkgs#microfetch
```
[crates.io]: https://crates.io/crates/microfetch
Non-Nix users, if they plan to run this for some reason, will need to build
Microfetch from source or install it with `cargo`. Microfetch is published on
[crates.io] and can be installed with `cargo install`.
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.
```bash
# Get Microfetch from crates.io
cargo install microfetch
cargo install --git https://github.com/notashelf/microfetch.git
```
### Other Distros
<!-- Remove & replace with "unofficial" warning if adding distro-specific instructions -->
To my knowledge, there is no package for (nor a reason to package) Microfetch
but if you run a patched version for your distribution, feel free to leave your
repository (AUR, COPR, etc.) here as reference for those that might be
interested in Microfetch tailored to their distributions.
Microfetch is _currently_ not available anywhere else. Though, does it _really_
have to be?
## Customizing
You can't*.
You can't.
### Why?
Customization, of most kinds, is "expensive": I could try reading environment
Customization, of most kinds, are expensive: I could try reading environment
variables, parse command-line arguments or read a configuration file to allow
configuring various fields but those inflate execution time and the resource
consumption by a lot. Since Microfetch is closer to a code golf challenge than a
program that attempts to fill a gap, I have elected not to make this trade. This
is, of course, not without a solution.
program that attempts to fill a gap, I have elected not to make this trade.
### Really?
@ -250,13 +217,13 @@ is, of course, not without a solution.
To be fair, you _can_ customize Microfetch by, well, patching it. It is
certainly not the easiest way of doing so but if you are planning to change
something in Microfetch, patching is the best way to go. It will also be the
only way that does not compromise on speed, unless you patch in bad code.
Various users have adapted Microfetch to their distribution of choice by
patching the [main module] and inserting the logo of their choice. This is also
the best way to go if you plan to make small changes. If your changes are not
small, you might want to look for a program that is designed to be customizable;
Microfetch is built for maximum performance and little else.
something in Microfetch, patching is the best way to go. It will also the only
way that does not compromise on speed, unless you patch in bad code. Various
users have adapted Microfetch to their distribution by patching the
[main module] and inserting the logo of their choice. This is also the best way
to go if you plan to make small changes. If your changes are not small, you
might want to look for a program that is designed to be customizable; Microfetch
is built for maximum performance.
The Nix package allows passing patches in a streamlined manner by passing
`.overrideAttrs` to the derivation. You can apply your patches in `patches` and

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB