Files
ponyfetch/flake.nix
2026-05-07 20:00:58 +04:00

63 lines
1.7 KiB
Nix

{
description = "A fastfetch wrapper that replaces the logo with ponysay";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
packages.default = pkgs.writeShellApplication {
name = "ponyfetch";
runtimeInputs = [
pkgs.fastfetch
pkgs.ponysay
];
text = ''
ponyfetch_args=()
ponysay_args=()
fastfetch_args=()
section="ponyfetch"
for arg in "$@"; do
if [ "$arg" = "--" ]; then
if [ "$section" = "ponyfetch" ]; then
section="ponysay"
elif [ "$section" = "ponysay" ]; then
section="fastfetch"
else
fastfetch_args+=("$arg")
fi
continue
fi
case "$section" in
ponyfetch)
ponyfetch_args+=("$arg")
;;
ponysay)
ponysay_args+=("$arg")
;;
fastfetch)
fastfetch_args+=("$arg")
;;
esac
done
if [ "''${#ponysay_args[@]}" -eq 0 ]; then
ponysay_args=(-q)
fi
ponysay "''${ponysay_args[@]}" | fastfetch --logo-type file-raw --logo - "''${fastfetch_args[@]}"
'';
};
});
}