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] [package]
name = "microfetch" name = "microfetch"
description = "Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed"
version = "0.4.13" version = "0.4.13"
edition = "2024" 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"
[lib] [lib]
name = "microfetch_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> <p>Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed</p>
<br/> <br/>
<a href="#synopsis">Synopsis</a><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> <a href="#installation">Installation</a>
<br/> <br/>
</div> </div>
@ -27,13 +27,11 @@ communities. Aims to replace [fastfetch] on my personal system, but
on your system: it is pretty _[fast](#benchmarks)_... on your system: it is pretty _[fast](#benchmarks)_...
<p align="center"> <p align="center">
<br/>
<img <img
alt="latest demo" alt="latest demo"
src="./assets/demo.png" src="./.github/assets/demo.png"
width="800px" width="850px"
> >
<br/>
</p> </p>
## Features ## Features
@ -57,14 +55,10 @@ on your system: it is pretty _[fast](#benchmarks)_...
- Shell Colors - Shell Colors
- Did I mention fast? - Did I mention fast?
- Respects [`NO_COLOR` spec](https://no-color.org/) - Respects [`NO_COLOR` spec](https://no-color.org/)
- Funny [^2]
[^1]: With the Mold linker, which is enabled by default in the Flake package, [^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 :) 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 ## Motivation
[Rube-Goldmark Machine]: https://en.wikipedia.org/wiki/Rube_Goldberg_machine [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 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, 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 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 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, 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 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 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 here as well, but do you think I hate myself?~~ Microfetch now features
handwritten assembly to unsafely optimize some areas. In hindsight you all 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 should have seen this coming. Is it faster? Yes.
want to.
Also see: [Rube-Goldmark Machine] 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 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 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. 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 ### Benchmarking Individual Functions
[Criterion.rs]: https://github.com/bheisler/criterion.rs [Criterion.rs]: https://github.com/bheisler/criterion.rs
@ -186,62 +169,46 @@ performance regressions.
## Installation ## Installation
> [!NOTE] > [!NOTE]
> You will need a Nerd Fonts patched font installed, and for your terminal > You will need a Nerdfonts patched font installed, and for your terminal
> emulator to support said font. Microfetch uses Nerd Fonts glyphs by default, > emulator to support said font. Microfetch uses nerdfonts glyphs by default,
> but this can be changed by [patching the program](#customizing). > but this can be changed by [patching the program](#customizing).
Microfetch is packaged in [nixpkgs](https://github.com/nixos/nixpkgs). It can be Microfetch is packaged in [nixpkgs](https://github.com/nixos/nixpkgs). It can be
installed by adding `pkgs.microfetch` to your `environment.systemPackages`. installed by adding `pkgs.microfetch` to your `environment.systemPackages`.
Additionally, you can try out Microfetch in a Nix shell or install it using Additionally, you can try out Microfetch in a Nix shell.
flakes on non-NixOS systems.
```bash ```bash
# Enter a Nix shell with Microfetch; this will be lost on the next GC
nix shell nixpkgs#microfetch 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` Or run it directly with `nix run`
```bash ```bash
# Run Microfetch from Nixpkgs. Subsequent runs will be faster.
nix run nixpkgs#microfetch nix run nixpkgs#microfetch
``` ```
[crates.io]: https://crates.io/crates/microfetch 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
Non-Nix users, if they plan to run this for some reason, will need to build source.
Microfetch from source or install it with `cargo`. Microfetch is published on
[crates.io] and can be installed with `cargo install`.
```bash ```bash
# Get Microfetch from crates.io cargo install --git https://github.com/notashelf/microfetch.git
cargo install microfetch
``` ```
### Other Distros Microfetch is _currently_ not available anywhere else. Though, does it _really_
have to be?
<!-- 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.
## Customizing ## Customizing
You can't*. You can't.
### Why? ### 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 variables, parse command-line arguments or read a configuration file to allow
configuring various fields but those inflate execution time and the resource 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 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 program that attempts to fill a gap, I have elected not to make this trade.
is, of course, not without a solution.
### Really? ### 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 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 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 something in Microfetch, patching is the best way to go. It will also the only
only way that does not compromise on speed, unless you patch in bad code. way that does not compromise on speed, unless you patch in bad code. Various
Various users have adapted Microfetch to their distribution of choice by users have adapted Microfetch to their distribution by patching the
patching the [main module] and inserting the logo of their choice. This is also [main module] and inserting the logo of their choice. This is also the best way
the best way to go if you plan to make small changes. If your changes are not to go if you plan to make small changes. If your changes are not small, you
small, you might want to look for a program that is designed to be customizable; might want to look for a program that is designed to be customizable; Microfetch
Microfetch is built for maximum performance and little else. is built for maximum performance.
The Nix package allows passing patches in a streamlined manner by passing The Nix package allows passing patches in a streamlined manner by passing
`.overrideAttrs` to the derivation. You can apply your patches in `patches` and `.overrideAttrs` to the derivation. You can apply your patches in `patches` and

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB