wrap fastfetch with config; run fastfetch on ssh login

This commit is contained in:
William 2025-11-03 10:55:14 -03:00
parent 716ed5cc53
commit 697a9f2cab
6 changed files with 93 additions and 11 deletions

View file

@ -5,4 +5,9 @@
enable = true; enable = true;
settings.PermitRootLogin = "no"; settings.PermitRootLogin = "no";
}; };
programs.fish.interactiveShellInit = ''
if set -q SSH_CONNECTION
neofetch
end
'';
} }

View file

@ -7,6 +7,7 @@
git git
### System Utilities ### ### System Utilities ###
btop btop
fastfetch
helix helix
nixos-firewall-tool nixos-firewall-tool
nvd nvd
@ -18,7 +19,6 @@
shellAliases = { shellAliases = {
cat = "${lib.getExe pkgs.bat} --paging=never --style=plain"; cat = "${lib.getExe pkgs.bat} --paging=never --style=plain";
ls = "${lib.getExe pkgs.eza} --icons --group-directories-first"; ls = "${lib.getExe pkgs.eza} --icons --group-directories-first";
neofetch = "${lib.getExe pkgs.fastfetch}";
tree = "ls --tree"; tree = "ls --tree";
}; };
}; };

View file

@ -20,10 +20,4 @@
hashedPassword = "!"; hashedPassword = "!";
}; };
}; };
programs.fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting
'';
};
} }

View file

@ -3,10 +3,11 @@
{ {
flake.overlays = { flake.overlays = {
default = final: prev: { default = final: prev: {
toggleaudiosink = inputs.self.packages.${final.system}.toggleaudiosink; base16-schemes = inputs.self.packages.${final.system}.base16-schemes;
fastfetch = inputs.self.packages.${final.system}.fastfetch;
hm-cli = inputs.self.packages.${final.system}.hm-cli; hm-cli = inputs.self.packages.${final.system}.hm-cli;
kwrite = inputs.self.packages.${final.system}.kwrite; kwrite = inputs.self.packages.${final.system}.kwrite;
base16-schemes = inputs.self.packages.${final.system}.base16-schemes; toggleaudiosink = inputs.self.packages.${final.system}.toggleaudiosink;
}; };
}; };
} }

View file

@ -5,10 +5,11 @@
{ pkgs, system, ... }: { pkgs, system, ... }:
{ {
packages = { packages = {
toggleaudiosink = pkgs.callPackage ./packages/toggleaudiosink.nix { }; base16-schemes = pkgs.callPackage ./packages/base16-schemes.nix { };
fastfetch = pkgs.callPackage ./packages/fastfetch.nix { };
hm-cli = pkgs.callPackage ./packages/hm-cli.nix { }; hm-cli = pkgs.callPackage ./packages/hm-cli.nix { };
kwrite = pkgs.callPackage ./packages/kwrite.nix { }; kwrite = pkgs.callPackage ./packages/kwrite.nix { };
base16-schemes = pkgs.callPackage ./packages/base16-schemes.nix { }; toggleaudiosink = pkgs.callPackage ./packages/toggleaudiosink.nix { };
}; };
}; };
} }

81
packages/fastfetch.nix Normal file
View file

@ -0,0 +1,81 @@
{
lib,
pkgs ? import <nixpkgs> { },
}:
let
fastfetch-logo = pkgs.fetchurl {
url = "https://discourse.nixos.org/uploads/default/original/3X/3/6/36954e6d6aa32c8b00f50ca43f142d898c1ff535.png";
hash = "sha256-aLHz8jSAFocrn+Pb4vRq0wtkYFJpBpZRevd+VoZC/PQ=";
};
fastfetch-config = pkgs.writeText "fastfetch-config.json" (
builtins.toJSON {
"$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json";
modules = [
"title"
"separator"
{
type = "os";
keyWidth = 9;
}
{
type = "kernel";
keyWidth = 9;
}
{
type = "uptime";
keyWidth = 9;
}
{
type = "shell";
keyWidth = 9;
}
"break"
{
type = "cpu";
keyWidth = 11;
}
{
type = "memory";
keyWidth = 11;
}
{
type = "swap";
keyWidth = 11;
}
{
type = "disk";
folders = "/";
keyWidth = 11;
}
{
type = "command";
key = "Systemd";
keyWidth = 11;
text = "echo \"$(systemctl list-units --state=failed --no-legend | wc -l) failed units, $(systemctl list-jobs --no-legend | wc -l) queued jobs\"";
}
"break"
{
type = "command";
key = "Public IP";
keyWidth = 15;
text = "curl -s -4 ifconfig.me 2>/dev/null || echo 'N/A'";
}
{
type = "command";
key = "Tailscale IP";
keyWidth = 15;
text = "tailscale ip -4 2>/dev/null || echo 'N/A'";
}
{
type = "command";
key = "Local IP";
keyWidth = 15;
text = "ip -4 addr show scope global | grep inet | head -n1 | awk '{print $2}' | cut -d/ -f1";
}
];
}
);
in
pkgs.writeShellScriptBin "fastfetch" ''exec ${lib.getExe pkgs.fastfetch} --config ${fastfetch-config} --logo-type kitty --logo ${fastfetch-logo} --logo-padding-right 1 --logo-width 36 "$@" ''