Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.ruff_cache/
.flatpak-builder/
.ignore/
.direnv/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
70 changes: 32 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a small tool built with fastfetch/neofetch, ffmpeg and chafa. It allows

## Installation

**Quick Links Installation Guide For:**
**Quick Links Installation Guide For:**

[Linux](#installation-for-linux-system) • [Windows](#installation-for-windows-winget-or-scoop) • [macOS](#installation-for-macos-homebrew) • [Manual](#manual-installation) • [Development](#developer-installation)

Expand Down Expand Up @@ -45,12 +45,10 @@ After installation, run this to test if anifetch was installed correctly:
anifetch example.mp4
```


Please read our [User guide](#user-guide) for more info on how to use anifetch.

---


### Installation for Windows (Winget or Scoop)

Check whether you have winget installed by running `winget` in the windows terminal. If you dont have it, install it [here](https://github.com/microsoft/winget-cli/?tab=readme-ov-file#installing-the-client). If you want, you can use [Scoop](https://scoop.sh/) instead. Just replace the `winget` part with `scoop`.
Expand All @@ -72,7 +70,6 @@ After installing the necessary dependencies using winget/scoop, install anifetch

Please read our [Post installation](#post-installation) and [User guide](#user-guide) for more info on how to use anifetch.


### Installation for macOS (HomeBrew)

Install homebrew if you haven't installed it already by following the guide [here](https://brew.sh/).
Expand Down Expand Up @@ -128,7 +125,6 @@ You can then run the `anifetch` command directly in your terminal.

Since pipx installs packages in an isolated environment, you won't have to worry about dependency conflicts or polluting your global python environment. `anifetch` will behave just like a native cli tool. You can upgrade your installation with `pipx upgrade anifetch`


---

### Installation for NixOS
Expand All @@ -137,12 +133,12 @@ Add the anifetch repo as a flake input:

```nix
{
inputs = {
anifetch = {
url = "github:Notenlish/anifetch";
inputs.nixpkgs.follows = "nixpkgs";
};
inputs = {
anifetch = {
url = "github:Notenlish/anifetch";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}
```

Expand All @@ -155,22 +151,23 @@ Remember to add:
to your nixos configuration, like I've done here on my system:

```nix
nixosConfigurations = {
Enlil = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
nixosConfigurations = {
Enlil = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
```

#### ❄️ As a package:

Add anifetch to your packages list like so:

```nix
{inputs, pkgs, ...}: {
environment.systemPackages = with pkgs; [
inputs.anifetch.packages.${pkgs.system}.default
fastfetch # Choose either fastfetch or neofetch to run anifetch with
neofetch
];
{ inputs, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
inputs.anifetch.packages.${pkgs.stdenv.hostPlatform.system}.default
fastfetch # Choose either fastfetch or neofetch to run anifetch with
neofetch
];
}
```

Expand All @@ -179,18 +176,19 @@ Add anifetch to your packages list like so:
Add the overlay to nixpkgs overlays, then add the package to your package list as you would a package from the normal nixpkgs repo.

```nix
{inputs, pkgs, ...}: {
nixpkgs = {
overlays = [
inputs.anifetch.overlays.anifetch
];
};

environment.systemPackages = with pkgs; [
anifetch
fastfetch # Choose either fastfetch or neofetch to run anifetch with
neofetch
{ inputs, pkgs, ... }:
{
nixpkgs = {
overlays = [
inputs.anifetch.overlays.default
];
};

environment.systemPackages = with pkgs; [
anifetch
fastfetch # Choose either fastfetch or neofetch to run anifetch with
neofetch
];
}
```

Expand All @@ -211,7 +209,6 @@ pip install -e .
```
> on windows do this to activate the venv instead: `venv\Scripts\activate`. Also on windows you should use `py` instead of `python3`.


This installs `anifetch` in editable mode within a local virtual environment for development.

You can then run the program in two ways:
Expand All @@ -225,14 +222,13 @@ On Nix you can run:

```bash
nix develop
pip install -e .
```

inside the anifetch dir after cloning the repo. This creates a python venv you can re-enter by running `nix develop` inside the project dir.
To install the package into a devshell. However, it is recommended to use [nix-direnv](https://github.com/nix-community/nix-direnv) to enter the development environment automatically, much like a python venv.

## User Guide

You don't need to configure anything for `fastfetch` or `neofetch`. If they already work on your machine, `anifetch` will detect and use them automatically. Please note that at least one of these must be installed, otherwise anifetch won't work. **By default, `anifetch` will use fastfetch**.
You don't need to configure anything for `fastfetch` or `neofetch`. If they already work on your machine, `anifetch` will detect and use them automatically. Please note that at least one of these must be installed, otherwise anifetch won't work. **By default, `anifetch` will use fastfetch**.

> We dont recommend using neofetch as it is archived. **To use neofetch**, you must append `-nf` to the anifetch command. For some distros you may need to append `--force` to the command too since neofetch is deprecated.

Expand All @@ -259,7 +255,7 @@ _Note : by default, the video `example.mp4` can directly be used as an example._
- `--cleanup`: Clears the screen on program exit.
- `-nf` / `--neofetch`: uses `neofetch` instead of `fastfetch`
- `-fr` / `--force-render`: Forcefully re-renders the animation while not caring about the cache. Useful if the cache is broken or the contents of the video file has changed.
- `-i` / `--interval`: Use this to make anifetch update the fetch information over time, sets fetch refresh interval in seconds. Default is -1(never).
- `-i` / `--interval`: Use this to make anifetch update the fetch information over time, sets fetch refresh interval in seconds. Default is -1(never).
- `-b` / `--benchmark`: For testing, prints how long it took to process in seconds.
- `--force`: Add this argument if you want to use neofetch even if it is deprecated on your system.
- `--chroma`: Add this argument to chromakey a hexadecimal color from the video using ffmpeg. Syntax: '--chroma \<hex-color>:\<similiarity>:\<blend>'
Expand Down Expand Up @@ -302,14 +298,12 @@ Add this to the end of `.bashrc`:
anifetch [video_file] [other_args_if_needed]
```


## Customizing Fastfetch/Neofetch output

For customizing fastfetch/neofetch output, you can check out these pages:
- [Fastfetch Customization](https://github.com/fastfetch-cli/fastfetch/wiki/Configuration)
- [Neofetch Customization](https://github.com/dylanaraps/neofetch/wiki/Customizing-Info)


## 📊 Benchmarks

Here's the benchmark from running each cli 10 times. Tested on Windows 11 with Intel I5-12500H processor.
Expand All @@ -328,7 +322,7 @@ Make sure to install the dependencies listed on [Prerequisites](#Prerequisites).

If weird characters are appearing in your terminal then your terminals font probably can't render some characters. Consider installling [nerdfonts](https://www.nerdfonts.com/).

If your OS is prompting you about `"Anifetch" is requesting special priviliges` or something similiar after pressing a key to stop the running Anifetch instance, add this argument: `--no-input-restore`. The technical reason for this is that Anifetch records the keys you press and enters them back to the terminal on your behalf. That way you can immediately run whatever command you want, without having to re-enter a key or two. Certain OS's have built-in protections against this as a security notice, which is why you might encounter a security prompt.
If your OS is prompting you about `"Anifetch" is requesting special priviliges` or something similiar after pressing a key to stop the running Anifetch instance, add this argument: `--no-input-restore`. The technical reason for this is that Anifetch records the keys you press and enters them back to the terminal on your behalf. That way you can immediately run whatever command you want, without having to re-enter a key or two. Certain OS's have built-in protections against this as a security notice, which is why you might encounter a security prompt.

## Notes

Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 45 additions & 44 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,52 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs = {
self,
nixpkgs,
...
}: let
inherit (self) outputs;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
packages = forAllSystems (system: import ./nix/packages nixpkgs.legacyPackages.${system});

overlays = import ./nix/overlays;
outputs =
{
self,
nixpkgs,
...
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
in
{
packages = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
default = pkgs.callPackage ./nix/package.nix { };
anifetch = self.packages.default;
}
);

formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
overlays = {
default = final: _prev: {
anifetch = import ./nix/package.nix final.pkgs;
};
anifetch = self.overlays.default;
};

devShell = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
myPython = pkgs.python3;
pythonWithPkgs = myPython.withPackages (ps: [
ps.pip
ps.setuptools
]);
venv = "venv";
in
pkgs.mkShell {
packages = [
pythonWithPkgs
pkgs.bc
pkgs.chafa
pkgs.ffmpeg
];
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-tree);

shellHook = ''
if [ ! -d "${venv}" ]; then
echo "Creating Python venv..."
python3 -m venv ${venv}
fi
echo "Activating venv..."
source ${venv}/bin/activate
'';
});
};
devShell = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
in
pkgs.mkShell {
packages = [
self.packages.${pkgs.stdenv.hostPlatform.system}.default
];
}
);
};
}
5 changes: 0 additions & 5 deletions nix/overlays/default.nix

This file was deleted.

41 changes: 41 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
python3Packages,
chafa,
ffmpeg,
lib,
...
}:
let
fs = lib.fileset;
sourceFiles = ../.;
in
fs.trace sourceFiles python3Packages.buildPythonApplication {
name = "anifetch-wrapped";
version = "git";
pyproject = true;
src = fs.toSource {
root = ../.;
fileset = sourceFiles;
};

build-system = with python3Packages; [
setuptools
];

dependencies = with python3Packages; [
chafa
ffmpeg
platformdirs
wcwidth
rich
pynput
];

meta = with lib; {
description = "neofetch but animated";
homepage = "https://github.com/Notenlish/anifetch";
license = licenses.mit;
maintainers = with maintainers; [ Immelancholy ];
mainProgram = "anifetch";
};
}
36 changes: 0 additions & 36 deletions nix/packages/anifetch.nix

This file was deleted.

4 changes: 0 additions & 4 deletions nix/packages/default.nix

This file was deleted.

Loading