Skip to content

alba4k/albafetch

Repository files navigation

albafetch ~by alba4k

Note: to prevent merge conflicts, please open your pull requests to the "development" branch, and check that one out before doing anything. Master is more stagnant and only updated when I know what I'm currently working on works as expected (most of the time).

intro

albafetch is a simple and fast program to display a lot of system information in a neofetch-like layout in way less than a second. I decided to make this as a challenge for myself and since I found neofetch too slow (which is understandable given that we're talking about a 10k+ lines shell script).

Preview This is what albafetch will likely look like by default:

default

And this is what my configuration looks like custom

Here is a time comparison (exact execution times change between machines and runs):

Time comparison

neofetch albafetch

You will find a lot of useful usage and configuration related info inside of the user manual and a small list of the things I changed since the last release in the changelog.

It currently supports a lot of GNU/Linux distributions, macOS (both x64 and arm64 macs) and even Android (only tested in Termux). Feel free to test any other platform :)

Table of contents

  1. Dependencies
  2. Compilation
  3. Installation
  4. Configuration

    example config

  5. Contributing

Dependencies

Build dependencies

These will also install the relative runtime dependencies

  • libpci:
  • libc (should already be installed):
  • A build system:
    • Make and meson are already set up, more details are found here. I am using gcc, but clang may also be used (when using make, append CC=clang or any other c compiler)

Runtime dependencies

I would like to eventually remove those, by checking at runtime if they are installed and not use them if not so. Also, in case albafetch was unable to get the info using libpci libraries, it'll fall back to lspci (as system shell commands).

  • libpci (for dynamically linked binaries):
  • there must be a sh binary in your PATH. This should already be satisfied on any UNIX-like system

Compilation

Using the Makefile

This will need gcc (make CC=[compiler] for other compilers, which should accept the same flags as gcc, e.g. clang) and make

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch
$ make

An executable file should appear as build/albafetch if the compilation succeeds.

Debug builds

It is possible to build a debug binary (build/debug) that will test every single function and make sure it runs correctly. This can be done by running

$ make debug

Using meson

If you prefer to build with meson/ninja, you can use these commands:

meson setup build
meson compile -C build

Like make, an executable file with appear in build/ if compilation succeeds

Using nix

Building with nix can make compiling in some ways much easier, such as when compiling statically or cross compiling. A few convenience outputs are included:

nix build .#albafetch # regular, dynamically linked build
nix build .#albafetch-static # statically linked build (only available on linux)
nix build .#albafetch-arm # cross compiling from x86_64 to arm (only available on x86_64)

Installation

For Arch Linux

An AUR package is available, albafetch-git. There are three packages on the AUR that provide albafetch:

  • albafetch will compile the source code of the latest release
  • albafetch-bin will install a pre-compiled binary from the latest release
  • albafetch-git will compile the source of the latest commit in master

You can find more information on how to install packages from the AUR in the Arch Wiki

For NixOS

nix profile:

$ nix profile install .#albafetch

nix-env:

$ nix-env -iA packages.<your platform>.albafetch # platform examples: x86_64-linux, aarch64-linux, aarch64-darwin

Using the overlay (Flake):

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    albafetch = {
      url = "github:alba4k/albafetch";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {nixpkgs, albafetch, ...}: {
    nixosConfigurations.host = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ./configuration.nix
        {
          nixpkgs.overlays = [albafetch.overlays.default];
          environment.systemPackages = [pkgs.albafetch];
        }
      ];
    };
  };
}

Using the overlay (builtins.fetchTarball):

{pkgs, ...}: {
  nixpkgs.overlays = [(import (builtins.fetchTarball "https://github.com/alba4k/albafetch/master.tar.gz")).overlays.default];
  environment.systemPackages = with pkgs; [
    albafetch
  ];
}

Manual installation

What if your OS is not included in the ones mentioned? In this case, you can either compile the source code yourself and install albafetch manually, or you can grab an executable from the latest release.

Please note that albafetch currently won't run on Windows (despite albafetch --logo windows being an option), but I'm planning to eventually add support (sooner or later). Feel free to help :)

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch

# make install

make install needs elevated privileges on Linux (e.g. sudo or a root shell) to write to /usr/bin, while /usr/local/bin can be accessed as a normal user on macOS.

Alternatively, you may prefer meson to do this:

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch
$ meson setup build
$ meson compile -C build
$ meson install -C build

Meson will install the executable to /usr/local/bin, which you may or may not want (executables in this directory are ran instead of ones in /usr/bin).

Configuration

albafetch can be customized using a config file, usually ~/.config/albafetch.conf.

You can find an example configuration file (which only provides the default values of every option) here. Although this file includes some short comments on how the various options work, I highly recommend checking out the user manual for a deeper understanding of the way this config file works.

Contributing

Almost everything included in this program is written in C.

If you want to, you can directly modify the source code contained in this repository and recompile the program afterwards to get some features you might want or need.

New logos can be added in src/logos.h (be careful to follow the format), new infos in src/info.c and src/info.h. You will also need to edit src/main.c afterwards to fully enable the new features.

Don't mind opening a pull request if you think some of the changes you made should be in the public version, just try to follow the coding style that I used in the rest of the project.

Any contribution, even just a fix of a typo, is highly appreciated.


© Aaron Blasko
Initially started in March 2022