mirror of
https://github.com/NotAShelf/microfetch.git
synced 2026-03-08 09:06:01 +00:00
Compare commits
3 commits
927dce4127
...
2066d781fe
| Author | SHA1 | Date | |
|---|---|---|---|
|
2066d781fe |
|||
|
cf3321b17a |
|||
|
7b8e736ff7 |
4 changed files with 83 additions and 55 deletions
12
Cargo.lock
generated
12
Cargo.lock
generated
|
|
@ -557,9 +557,9 @@ checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hotpath"
|
name = "hotpath"
|
||||||
version = "0.7.5"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08382b985a19a79d95d35e2e201b02cc4b99efe2f47d82f3fd4301bb0005bb68"
|
checksum = "4b0a2c66c081fe3684a54a7e5d059c9d9ad6b3ee5ccea14f6e4f056dbd77becf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
"base64",
|
"base64",
|
||||||
|
|
@ -586,9 +586,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hotpath-macros"
|
name = "hotpath-macros"
|
||||||
version = "0.7.5"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7d618063f89423ebe079a69f5435a13d4909219d4e359757118b75fd05ae65d0"
|
checksum = "a38fa43ca80cf906cd05127e490d740a51abb38316db7bce9d95e89724a81761"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|
@ -786,9 +786,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.177"
|
version = "0.2.178"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
|
checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libredox"
|
name = "libredox"
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ name = "microfetch"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hotpath = { optional = true, version = "0.7.5" }
|
hotpath = { optional = true, version = "0.8.0" }
|
||||||
libc = "0.2.177"
|
libc = "0.2.178"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.8.0"
|
criterion = "0.8.0"
|
||||||
|
|
|
||||||
114
README.md
114
README.md
|
|
@ -6,15 +6,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="doc-begin" align="center">
|
<div id="doc-begin" align="center">
|
||||||
<h1 id="header">
|
<h1 id="header">Microfetch</h1>
|
||||||
Microfetch
|
<p>Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed</p>
|
||||||
</h1>
|
|
||||||
<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><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>
|
||||||
|
|
@ -65,34 +61,42 @@ on your system: it is pretty _[fast](#benchmarks)_...
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
Fastfetch, as its name probably hinted, is a very fast fetch tool written in C.
|
[Rube-Goldmark Machine]: https://en.wikipedia.org/wiki/Rube_Goldberg_machine
|
||||||
However, I am not interested in _any_ of its additional features, and I'm not
|
|
||||||
interested in its configuration options. Sure I can _configure_ it when I
|
|
||||||
dislike the defaults, but how often would I really change the configuration...
|
|
||||||
|
|
||||||
Microfetch is my response to this problem. It is an _even faster_ fetch tool
|
Fastfetch, as its name _probably_ already hinted, is a very fast fetch tool
|
||||||
that I would've written in Bash and put in my `~/.bashrc` but is _actually_
|
written in C. I used to use Fastfetch on my systems, but I eventually came to
|
||||||
incredibly fast because it opts out of all the customization options provided by
|
the realization that I am _not interested in any of its additional features_. I
|
||||||
tools such as Fastfetch. Ultimately, it's a small, opinionated binary with a
|
don't use Sixel, I don't change my configuration more than maybe once a year and
|
||||||
nice size that doesn't bother me, and incredible speed. Customization? No thank
|
I don't even display most of the fields that it does. Sure the configurability
|
||||||
you. I cannot re-iterate it enough, Microfetch is _annoyingly fast_.
|
is nice and I can configure the defaults that I do not like but how often do I
|
||||||
|
really do that?
|
||||||
|
|
||||||
The project is written in Rust, which comes at the cost of "bloated" dependency
|
Since I already enjoy programming challenges, and don't use a fetch program that
|
||||||
trees and the increased build times, but we make an extended effort to keep the
|
often, I eventually came to try and answer the question _how fast can I make my
|
||||||
dependencies minimal and build times managable. The latter is also very easily
|
fetch script?_ It is an _even faster_ fetch tool that I would've written in Bash
|
||||||
mitigated with Nix's binary cache systems. Since Microfetch is already in
|
and put in my `~/.bashrc` but is _actually_ incredibly fast because it opts out
|
||||||
Nixpkgs, you are recommended to use it to utilize the binary cache properly. The
|
of all the customization options provided by tools such as Fastfetch. Since
|
||||||
usage of Rust _is_ nice, however, since it provides us with incredible tooling
|
Fetch scripts are kind of a coming-of-age ritual for most Linux users, I've
|
||||||
and a very powerful language that allows for Microfetch to be as fast as
|
decided to use it on my system. You also might be interested if you like the
|
||||||
possible. Sure C could've been used here as well, but do you think I hate
|
defaults and like speed.
|
||||||
myself?
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
Ultimately, it's a small, opinionated binary with a nice size that doesn't
|
||||||
> **Update as of November 30th, 2025**:
|
bother me, and incredible speed. Customization? No thank you. I cannot
|
||||||
>
|
re-iterate it enough, Microfetch is _annoyingly fast_. It does not, however,
|
||||||
> Microfetch now inlines handwritten assembly for even better performance. I
|
solve a technical problem. The "problem" Microfetch solves is entirely
|
||||||
> know I previously said I do not hate myself but I'm beginning to suspect this
|
self-imposed. On the matter of _size_, the project is written in Rust, which
|
||||||
> is no longer the case. Enjoy the performance benefits!
|
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
|
||||||
|
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.
|
||||||
|
|
||||||
|
Also see: [Rube-Goldmark Machine]
|
||||||
|
|
||||||
## Benchmarks
|
## Benchmarks
|
||||||
|
|
||||||
|
|
@ -200,17 +204,31 @@ You can't.
|
||||||
|
|
||||||
### Why?
|
### Why?
|
||||||
|
|
||||||
Customization, of any kind, 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 but all of
|
variables, parse command-line arguments or read a configuration file to allow
|
||||||
those increment execution time and resource consumption by a lot.
|
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.
|
||||||
|
|
||||||
### Really?
|
### Really?
|
||||||
|
|
||||||
To be fair, you _can_ customize Microfetch by, well, patching it. It's not the
|
[main module]: ./src/main.rs
|
||||||
best way per se, but it will be the only way that does not compromise on speed.
|
[discussions tab]: https://github.com/NotAShelf/microfetch/discussions
|
||||||
|
|
||||||
|
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 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
|
The Nix package allows passing patches in a streamlined manner by passing
|
||||||
`.overrideAttrs` to the derivation.
|
`.overrideAttrs` to the derivation. You can apply your patches in `patches` and
|
||||||
|
share your derivations with people. Feel free to use the [discussions tab] to
|
||||||
|
share your own variants of Microfetch!
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
@ -222,13 +240,22 @@ Contributions that help improve performance in specific areas of Microfetch are
|
||||||
welcome. Though, prepare to be bombarded with questions if your changes are
|
welcome. Though, prepare to be bombarded with questions if your changes are
|
||||||
large.
|
large.
|
||||||
|
|
||||||
## Hacking
|
### Hacking
|
||||||
|
|
||||||
A Nix flake is provided. `nix develop` to get started. Direnv users may simply
|
A Nix flake is provided. You may use `nix develop` to get started. Direnv users
|
||||||
run `direnv allow` to get started.
|
may instead run `direnv allow` to get a complete environment with shell
|
||||||
|
integration.
|
||||||
|
|
||||||
Non-nix users will need `cargo` and `gcc` installed on their system, see
|
Non-Nix user will need `cargo`, `clang` and `mold` installed on their system to
|
||||||
`Cargo.toml` for available release profiles.
|
build Microfetch. As Mold seems to yield _slightly_ better results than the
|
||||||
|
default linker, it has been set as the default in `.cargo/config.toml` for
|
||||||
|
x86-64 Linux. You may override those defaults using the `RUSTFLAGS` environment
|
||||||
|
variable. For example:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Use ld instead of Mold
|
||||||
|
$ RUSTFLAGS="-C linker=/path/to/ld.lld" cargo build
|
||||||
|
```
|
||||||
|
|
||||||
## Thanks
|
## Thanks
|
||||||
|
|
||||||
|
|
@ -245,6 +272,7 @@ person about current issues. To list a few, special thanks to:
|
||||||
- [@sioodmy](https://github.com/sioodmy) - Being cute
|
- [@sioodmy](https://github.com/sioodmy) - Being cute
|
||||||
- [@mewoocat](https://github.com/mewoocat) - The awesome NixOS logo ASCII used
|
- [@mewoocat](https://github.com/mewoocat) - The awesome NixOS logo ASCII used
|
||||||
in Microfetch
|
in Microfetch
|
||||||
|
- [@uzaaft](https://github.com/uzaaft) - Helping me going faster
|
||||||
|
|
||||||
Additionally a big thank you to everyone who used, talked about or criticized
|
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.
|
Microfetch. I might have missed your name here, but you have my thanks.
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ fn print_system_info(
|
||||||
{blue} ▟█▛ {blue}▝█▘{cyan}▟█▛ {cyan} {blue}Shell{reset} {shell}
|
{blue} ▟█▛ {blue}▝█▘{cyan}▟█▛ {cyan} {blue}Shell{reset} {shell}
|
||||||
{blue}▟█████▛ {cyan}▟█████▛ {cyan} {blue}Uptime{reset} {uptime}
|
{blue}▟█████▛ {cyan}▟█████▛ {cyan} {blue}Uptime{reset} {uptime}
|
||||||
{blue} ▟█▛{cyan}▗█▖ {cyan}▟█▛ {cyan} {blue}Desktop{reset} {desktop}
|
{blue} ▟█▛{cyan}▗█▖ {cyan}▟█▛ {cyan} {blue}Desktop{reset} {desktop}
|
||||||
{blue} ▝█▛ {cyan}██▖{blue}▗▄▄▄▄▄▄▄▄▄▄▄ {cyan} {blue}Memory{reset} {memory_usage}
|
{blue} ▝█▛ {cyan}██▖{blue}▗▄▄▄▄▄▄▄▄▄▄▄ {cyan} {blue}Memory{reset} {memory_usage}
|
||||||
{blue} ▝ {cyan}▟█▜█▖{blue}▀▀▀▀▀██▛▀▀▘ {cyan} {blue}Storage (/){reset} {storage}
|
{blue} ▝ {cyan}▟█▜█▖{blue}▀▀▀▀▀██▛▀▀▘ {cyan} {blue}Storage (/){reset} {storage}
|
||||||
{cyan} ▟█▘ ▜█▖ {blue}▝█▛ {cyan} {blue}Colors{reset} {colors}\n\n"
|
{cyan} ▟█▘ ▜█▖ {blue}▝█▛ {cyan} {blue}Colors{reset} {colors}\n\n"
|
||||||
)?;
|
)?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue