rework: more TUIs! (#62)

Signed-off-by: Hadi <[email protected]>
This commit is contained in:
Hadi
2026-09-28 20:18:12 +02:00
committed by GitHub
parent 1a3f23f248
commit 07a60e91d2
98 changed files with 1280 additions and 1093 deletions
+137
View File
@@ -0,0 +1,137 @@
# Elio is a TUI file explorer
{
pkgs,
config,
...
}: let
c = config.lib.stylix.colors;
# TODO: Waiting for a version in nixpkgs
version = "1.12.0";
sources = {
"x86_64-linux" = {
url = "https://github.com/elio-fm/elio/releases/download/v${version}/elio-${version}-x86_64-unknown-linux-gnu.tar.gz";
hash = "sha256-9cW/xUA9p0LEYI3/j4MGPVZvcyJpV1JYKYBuHur4sTM=";
};
};
source =
sources.${pkgs.stdenv.hostPlatform.system}
or (throw "elio: unsupported platform ${pkgs.stdenv.hostPlatform.system}");
elio = pkgs.stdenv.mkDerivation {
pname = "elio";
inherit version;
src = pkgs.fetchurl {inherit (source) url hash;};
nativeBuildInputs = [pkgs.autoPatchelfHook];
buildInputs = [pkgs.stdenv.cc.cc.lib];
installPhase = ''
runHook preInstall
install -Dm755 elio -t $out/bin
for size in 48 128 256 512; do
install -Dm644 \
"packaging/linux/icons/hicolor/''${size}x''${size}/apps/elio.png" \
"$out/share/icons/hicolor/''${size}x''${size}/apps/elio.png"
done
install -Dm644 packaging/linux/elio.desktop -t $out/share/applications
runHook postInstall
'';
meta = {
description = "Terminal file manager";
homepage = "https://github.com/elio-fm/elio";
license = pkgs.lib.licenses.mit;
mainProgram = "elio";
platforms = builtins.attrNames sources;
sourceProvenance = [pkgs.lib.sourceTypes.binaryNativeCode];
};
};
in {
home.packages = [
elio
pkgs.poppler-utils # PDF previews
pkgs.ffmpeg # media metadata and thumbnails
pkgs.resvg # SVG previews
];
xdg.desktopEntries.elio = {
name = "elio";
exec = "${pkgs.ghostty}/bin/ghostty +new-window -e ${elio}/bin/elio %f";
terminal = false;
icon = "elio";
mimeType = ["inode/directory"];
categories = ["System" "FileManager" "FileTools" "ConsoleOnly"];
};
xdg.configFile."elio/config.toml".text = ''
[places]
show_devices = false
entries = [
"home",
"documents",
"downloads",
"pictures",
{ title = "Notes", path = "~/Notes" },
{ title = "Cyber", path = "~/Cyber" },
{ title = "Projects", path = "~/Projects" },
{ title = "NixOS Config", path = "~/.config/nixos" },
"trash",
]
'';
xdg.configFile."elio/theme.toml".text = ''
[palette]
bg = "#${c.base00}"
chrome = "#${c.base01}"
chrome_alt = "#${c.base01}"
chip_text = "#${c.base00}"
panel = "#${c.base00}"
panel_alt = "#${c.base00}"
surface = "#${c.base02}"
elevated = "#${c.base02}"
border = "#${c.base03}"
text = "#${c.base05}"
muted = "#${c.base04}"
accent = "#${c.base0D}"
accent_soft = "#${c.base02}"
accent_text = "#${c.base06}"
selected_bg = "#${c.base02}"
selected_border = "#${c.base0D}"
selection_bar = "#${c.base09}"
yank_bar = "#${c.base0B}"
cut_bar = "#${c.base08}"
progress_bar = "#${c.base0D}"
grid_selection_band = "#${c.base02}"
grid_yank_band = "#${c.base01}"
grid_cut_band = "#${c.base01}"
sidebar_active = "#${c.base02}"
button_bg = "#${c.base01}"
button_disabled_bg = "#${c.base01}"
path_bg = "#${c.base00}"
[preview.code]
fg = "#${c.base05}"
bg = "#${c.base01}"
selection_bg = "#${c.base02}"
selection_fg = "#${c.base06}"
caret = "#${c.base0C}"
line_highlight = "#${c.base01}"
line_number = "#${c.base03}"
comment = "#${c.base03}"
string = "#${c.base0B}"
constant = "#${c.base09}"
keyword = "#${c.base0E}"
function = "#${c.base0D}"
type = "#${c.base0A}"
parameter = "#${c.base08}"
tag = "#${c.base0C}"
operator = "#${c.base0C}"
macro = "#${c.base0F}"
invalid = "#${c.base08}"
'';
}
+41
View File
@@ -0,0 +1,41 @@
# Ghostty is a terminal emulator
{
pkgs,
config,
...
}: let
cursorShaders = pkgs.fetchFromGitHub {
owner = "sahaj-b";
repo = "ghostty-cursor-shaders";
rev = "06d4e90fb5410e9c4d0b3131584060adddf89406";
hash = "sha256-G/UIr1bKnxn1AcHl/4FL/jou6b7M2VeREslYVELxdmw=";
};
c = config.lib.stylix.colors;
in {
home.sessionVariables = {
TERMINAL = "ghostty";
TERM = "ghostty";
};
programs.ghostty = {
enable = true;
installVimSyntax = true;
enableZshIntegration = true;
settings = {
window-padding-x = 10;
confirm-close-surface = false;
window-padding-y = 10;
gtk-single-instance = true;
clipboard-read = "allow";
clipboard-write = "allow";
copy-on-select = "clipboard";
app-notifications = false;
custom-shader = "${cursorShaders}/cursor_warp.glsl";
custom-shader-animation = "always";
mouse-scroll-multiplier = "discrete:1";
keybind = [
"shift+ctrl+tab=new_tab"
];
};
};
}
+64
View File
@@ -0,0 +1,64 @@
# Git configuration
{
config,
lib,
...
}: let
username = config.var.git.username;
email = config.var.git.email;
in {
imports = [./lazygit.nix];
programs = {
gh.enable = true;
git = {
enable = true;
ignores = [
".cache/"
".DS_Store"
".idea/"
"*.swp"
"*.elc"
"auto-save-list"
".direnv/"
"node_modules"
"result"
"result-*"
".superpowers/"
".claude/"
"docs/superpowers/"
];
settings = {
user.name = username;
user.email = email;
init.defaultBranch = "main";
pull.rebase = "true";
push.autoSetupRemote = true;
color.ui = "1";
alias = {
co = "checkout";
fuck = "commit --amend -m";
c = "commit -m";
ca = "commit -am";
forgor = "commit --amend --no-edit";
graph = "log --all --decorate --graph --oneline";
oops = "checkout --";
l = "log";
r = "rebase";
s = "status --short";
ss = "status";
d = "diff";
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)";
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)";
st = "status";
br = "branch";
hist = ''log --pretty=format:"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)" --graph --date=relative --decorate --all'';
llog = ''log --graph --name-status --pretty=format:"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset" --date=relative'';
};
};
};
};
home.persistence."/persist" = lib.mkIf (config.var.impermanenceEnabled or false) {
directories = [".config/gh"];
};
}
+38
View File
@@ -0,0 +1,38 @@
# Lazygit is a simple terminal UI for git commands.
{
config,
lib,
...
}: let
accent = "#${config.lib.stylix.colors.base0D}";
muted = "#${config.lib.stylix.colors.base03}";
in {
programs.lazygit = {
enable = true;
settings = lib.mkForce {
disableStartupPopups = true;
notARepository = "skip";
promptToReturnFromSubprocess = false;
update.method = "never";
git = {
commit.signOff = true;
overrideGpg = true;
parseEmoji = true;
};
gui = {
theme = {
activeBorderColor = [
accent
"bold"
];
inactiveBorderColor = [muted];
};
showListFooter = false;
showRandomTip = false;
showCommandLog = false;
showBottomLine = false;
nerdFontsVersion = "3";
};
};
};
}
+15
View File
@@ -0,0 +1,15 @@
# This file is used to sign git commits using an SSH key.
{
# CHANGEME: change this to your own SSH key.
# ~/.ssh/key.pub itself is managed by sops (see hosts/laptop/secrets/default.nix: signing-pub-key).
home.file.".ssh/allowed_signers".text = "* ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIINhWby7lUUXQNKbRu9/UOrGjWDf3fvoAwGHomWv/+lL";
programs.git = {
settings = {
commit.gpgsign = true;
gpg.ssh.allowedSignersFile = "~/.ssh/allowed_signers";
gpg.format = "ssh";
user.signingkey = "~/.ssh/key.pub";
};
};
}
+26
View File
@@ -0,0 +1,26 @@
{config, ...}: let
c = config.lib.stylix.colors;
in {
home.file.".config/ilovetui/config.yaml".text = ''
nerd_fonts: true
border: rounded
layout_border: full
colors:
base00: "#${c.base00}" # Background
base01: "#${c.base01}" # Lighter Background / Status Bars
base02: "#${c.base02}" # Selection Background
base03: "#${c.base03}" # Comments / Invisibles
base04: "#${c.base04}" # Dark Foreground / Status Bars
base05: "#${c.base05}" # Default Foreground
base06: "#${c.base06}" # Light Foreground
base07: "#${c.base07}" # Light Background
base08: "#${c.base08}" # Variables / Errors / Diff Deleted
base09: "#${c.base09}" # Integers / Constants / Booleans
base0a: "#${c.base0A}" # Classes / Warnings / Search Background
base0b: "#${c.base0B}" # Strings / Success / Diff Inserted
base0c: "#${c.base0C}" # Support / Regex / Escape Characters
base0d: "#${c.base0D}" # Functions / Methods / Headings / Accent
base0e: "#${c.base0E}" # Keywords / Storage / Diff Changed
base0f: "#${c.base0F}" # Embedded / Misc
'';
}
+45
View File
@@ -0,0 +1,45 @@
# Kew is a TUI audio player
{
pkgs,
lib,
config,
...
}: let
kewLauncher = pkgs.writeShellScript "kew-launcher" ''
if [ -n "$1" ]; then
exec ${pkgs.kew}/bin/kew play "$1"
else
exec ${pkgs.kew}/bin/kew
fi
'';
in {
home.packages = with pkgs; [
kew
];
home.persistence."/persist" = lib.mkIf (config.var.impermanenceEnabled or false) {
directories = [
".config/kew"
];
};
xdg.desktopEntries.kew = {
name = "Music Player";
exec = "${pkgs.ghostty}/bin/ghostty --window-padding-x=0 --window-padding-y=0 -e ${kewLauncher} %f";
comment = "Play music from the terminal";
categories = ["Audio" "Music"];
terminal = false;
mimeType = [
"audio/aac"
"audio/mpeg"
"audio/ogg"
"audio/opus"
"audio/vnd.wave"
"audio/webm"
"audio/x-matroska"
"audio/flac"
"audio/mp4"
];
settings.Keywords = "lofi;player;music;";
};
}
+21
View File
@@ -0,0 +1,21 @@
{pkgs, ...}: let
btopPackage = pkgs.btop.override {cudaSupport = true;};
in {
programs.btop = {
enable = true;
package = btopPackage;
settings = {
vim_keys = true;
shown_boxes = "cpu mem net proc gpu0";
};
};
xdg.desktopEntries.btop = {
name = "btop++";
exec = "${pkgs.ghostty}/bin/ghostty +new-window -e ${btopPackage}/bin/btop";
comment = "Ressources monitor (btop)";
categories = ["Settings"];
terminal = false;
settings.Keywords = "ressource;ressources;btop;usage;monitoring;cpu;gpu;memory";
};
}
+5
View File
@@ -0,0 +1,5 @@
{
programs = {
cava.enable = true;
};
}
+49
View File
@@ -0,0 +1,49 @@
{
pkgs,
config,
lib,
inputs,
...
}: {
home.packages = import ./pkgs.nix {
inherit pkgs;
};
home.file = {
"Cyber/wordlists/seclists".source = pkgs.fetchFromGitHub {
owner = "danielmiessler";
repo = "SecLists";
rev = "47aa98053fce8670c6489e4f6fb57dc34881d8bd";
hash = "sha256-ojXLB/TXap1Qi0MtV5/WJlJpjNIDYx/sLY2KHm0uFKI=";
};
"Cyber/wordlists/fuzz4bounty".source = pkgs.fetchFromGitHub {
owner = "0xPugal";
repo = "fuzz4bounty";
rev = "a805f6b434033f054312da0ddc2bc3021cc9a3b0";
hash = "sha256-wMhx1CcxIyw2E7gJXQxXAFc7m5nYt0FXNkoTZqFMQh4=";
};
# RULES
"Cyber/wordlists/rules/oneruletorulethemstill".source = pkgs.fetchFromGitHub {
owner = "stealthsploit";
repo = "oneruletorulethemstill";
rev = "4bfb7322e189305b5f35bb7fcd4e9cc233c3d3c6";
hash = "sha256-h7MeymIXS/6wlPRt4lzsIEqOOssP0lDx9nQip65cwZw=";
};
"Cyber/wordlists/rules/best64.rule".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/CarlosLannister/OwadeReborn/refs/heads/master/owade/fileAnalyze/hashcatLib/best64.rule%7E";
hash = "sha256-T0XkMHJZQiy63/j25nGTkaiDFjc+blmgEVGTAFgVylU=";
};
# Open source list of default credentials
".cache/default-creds".source = inputs.default-creds;
};
home.persistence."/persist" = lib.mkIf (config.var.impermanenceEnabled or false) {
directories = [
"Cyber"
];
};
}
+45
View File
@@ -0,0 +1,45 @@
{pkgs}: (with pkgs; [
# Web
pkgs.nur.repos.anotherhadi.spilltea
dirb
ffuf
katana
whatweb
sqlmap
nosqli
# Hashes
hashcat
haiti
john
# Databases
mariadb
redis
# Network
termshark # wireshark in TUI
wtfis # Passive hostname, domain and IP lookup tool
inetutils
whois
dig
nmap
samba
hydra
pkgs.nur.repos.anotherhadi.revshell
# Reverse
binsider # Analyzer of executables using a terminal user interface
# Misc
metasploit
nuclei
openvpn
zizmor # CI/CD Pipelines
trufflehog # Look for secrets
pkgs.nur.repos.anotherhadi.jwt-tui
pkgs.nur.repos.anotherhadi.default-creds-tui
# Forensics
binwalk
])
+6
View File
@@ -0,0 +1,6 @@
{lib, ...}: let
utils = import ../../lib/utils.nix {inherit lib;};
in {
imports =
utils.importAll ./.;
}
+35
View File
@@ -0,0 +1,35 @@
{
pkgs,
pkgs-unstable,
config,
lib,
...
}: {
home = {
packages = with pkgs-unstable;
[
go
claude-code
bun
]
++ (with pkgs; [
nodejs
air
duckdb
python3
jq
nix-prefetch-github
rsync
]);
persistence."/persist" = lib.mkIf (config.var.impermanenceEnabled or false) {
directories = [
".claude"
];
files = [".claude.json"];
};
sessionPath = ["$HOME/.local/share/go/bin"];
sessionVariables.GOPATH = "$HOME/.local/share/go";
};
}
+25
View File
@@ -0,0 +1,25 @@
# Feature-rich TUI RSS reader based on the news-flash library
{
config,
lib,
pkgs,
pkgs-unstable,
...
}: {
home.packages = [
pkgs-unstable.eilmeldung
];
home.persistence."/persist" = lib.mkIf (config.var.impermanenceEnabled or false) {
directories = [".config/eilmeldung"];
};
xdg.desktopEntries.eilmeldung = {
name = "eilmeldung";
exec = "${pkgs.ghostty}/bin/ghostty +new-window -e ${pkgs-unstable.eilmeldung}/bin/eilmeldung";
comment = "Feature-rich TUI RSS reader";
categories = ["Network" "ConsoleOnly"];
terminal = false;
settings.Keywords = "rss;feed;news;reader";
};
}
+15
View File
@@ -0,0 +1,15 @@
# Monitui allows you to edit hyprland's monitor configuration
{pkgs, ...}: {
home.packages = [
pkgs.nur.repos.anotherhadi.monitui
];
xdg.desktopEntries.monitui = {
name = "monitui";
exec = "${pkgs.ghostty}/bin/ghostty +new-window -e ${pkgs.nur.repos.anotherhadi.monitui}/bin/monitui";
comment = "Delightfully minimal TUI for wrangling Hyprland monitors";
categories = ["Settings" "HardwareSettings"];
terminal = false;
settings.Keywords = "hyprland;monitor;display;screen;resolution";
};
}
+5
View File
@@ -0,0 +1,5 @@
{
programs.navi = {
enable = true;
};
}
+5
View File
@@ -0,0 +1,5 @@
{inputs, ...}: {
imports = [inputs.nix-index-database.homeModules.default];
programs.nix-index.enable = true;
programs.nix-index-database.comma.enable = true;
}
+15
View File
@@ -0,0 +1,15 @@
# TUI for managing USBGuard rules
{pkgs, ...}: {
home.packages = [
pkgs.nur.repos.anotherhadi.usbguard-tui
];
xdg.desktopEntries.usbguard-tui = {
name = "USBGuard TUI";
exec = "${pkgs.ghostty}/bin/ghostty +new-window -e ${pkgs.polkit}/bin/pkexec ${pkgs.nur.repos.anotherhadi.usbguard-tui}/bin/usbguard-tui";
comment = "Manage USBGuard rules";
categories = ["Settings"];
terminal = false;
settings.Keywords = "usb;usbguard;security;devices;rules";
};
}
+31
View File
@@ -0,0 +1,31 @@
# - ## Nixy
#-
#- Nixy is a simple script that I use to manage my NixOS system. It's a simple script that provides a menu to rebuild, test, update, collect garbage, clean boot menu, etc.
#-
#- - `nixy` - UI wizard to manage the system.
#- - `nixy rebuild` - Rebuild the system.
#- - `nixy ...` - ... see the script for more commands.
{
config,
lib,
pkgs,
...
}: {
options.programs.nixy = {
enable = lib.mkEnableOption "nixy";
configDirectory = lib.mkOption {
type = lib.types.str;
default = "$HOME/.config/nixos";
description = "Path to the NixOS configuration directory";
};
};
config = lib.mkIf config.programs.nixy.enable {
home.packages = [
(import ./package.nix {
inherit pkgs;
inherit (config.programs.nixy) configDirectory;
})
];
};
}
+14
View File
@@ -0,0 +1,14 @@
{
pkgs,
system,
...
}: {
packages.${system}.nixy = import ./package.nix {
inherit pkgs;
configDirectory = "$HOME/.config/nixos";
};
homeManagerModules.nixy = {
imports = [./default.nix];
};
}
+69
View File
@@ -0,0 +1,69 @@
{
pkgs,
configDirectory,
}:
pkgs.writeShellScriptBin "nixy"
# bash
''
EXTRA_ARGS="''${@:2}"
function exec() {
$@
}
function ui(){
DEFAULT_ICON="󰘳"
# "icon;name;command"[]
apps=(
"󰑓;Rebuild;nixy rebuild"
"󰐊;Test;nixy test"
"󰚰;Update;nixy update"
";Collect Garbage;nixy gc"
"󰍜;Clean Boot Menu;nixy cb"
";List generation;nixy listgen"
)
# Apply default icons if empty:
for i in "''${!apps[@]}"; do
apps[i]=$(echo "''${apps[i]}" | sed 's/^;/'$DEFAULT_ICON';/')
done
fzf_result=$(printf "%s\n" "''${apps[@]}" | awk -F ';' '{print $1" "$2}' | fzf)
[[ -z $fzf_result ]] && exit 0
fzf_result=''${fzf_result/ /;}
line=$(printf "%s\n" "''${apps[@]}" | grep "$fzf_result")
command=$(echo "$line" | sed 's/^[^;]*;//;s/^[^;]*;//')
exec "$command"
exit $?
}
[[ $1 == "" ]] && ui
if [[ $1 == "rebuild" ]];then
cd ${configDirectory} && git add . && sudo nixos-rebuild switch --flake . $EXTRA_ARGS
elif [[ $1 == "test" ]];then
cd ${configDirectory} && git add . && sudo nixos-rebuild test --flake . $EXTRA_ARGS
elif [[ $1 == "update" ]];then
cd ${configDirectory} && nix flake update $EXTRA_ARGS
elif [[ $1 == "gc" ]];then
echo "Starting Nix garbage collection..."
cd ${configDirectory} && \
echo "Cleaning up system garbage..." && \
sudo nix-collect-garbage -d && \
echo "Cleaning up user garbage..." && \
nix-collect-garbage -d && \
echo "Collecting garbage from Nix store..." && \
nix-store --gc && \
echo "Optimizing Nix store..." && \
nix-store --optimise
echo "Nix garbage collection complete."
elif [[ $1 == "cb" ]];then
sudo /run/current-system/bin/switch-to-configuration boot
elif [[ $1 == "listgen" ]];then
sudo nix-env -p /nix/var/nix/profiles/system --list-generations
else
echo "Unknown argument"
fi
''
+40
View File
@@ -0,0 +1,40 @@
{
pkgs,
pkgs-unstable,
config,
lib,
...
}: {
home.packages = with pkgs; [
# I love TUIs
caligula # User-friendly, lightweight TUI for disk imaging (ISO, USB BOOT)
sttr # A minimalist CyberChef-like, cross-platform CLI app for performing various operations on strings
slides # A terminal-based presentation tool that allows you to create and deliver presentations directly from the command line
tabiew # A terminal-based CSV viewer and manipulator
jless # A pager for JSON
dua # Tool to conveniently learn about the disk usage of directories
mcat # Cat command for documents / images / videos and more
lazyjournal
vhs # Create GIF from the command-line
pkgs.nur.repos.anotherhadi.settuings # Terminal based settings (wifi, bluetooth, audio, ...)
pkgs.nur.repos.anotherhadi.fztea # Flipper Zero from the terminal
pkgs-unstable.pomo # Pomodoro timer in your terminal
httpie # Command-line HTTP client, a user-friendly cURL replacement
figlet # Transform text into ASCII art
pastel # Command-line tool to generate, analyze, convert and manipulate colors
imagemagick # Image manipulation tool
chafa # Image to ANSI/Unicode converter and more.
pkgs-unstable.yt-dlp
# Just cool
tty-solitaire
bastet
peaclock
cbonsai
pipes
cmatrix
fastfetch
smassh # typing test, 10fastfinger like
];
}
+8
View File
@@ -0,0 +1,8 @@
{
# TODO: proton-pass-agent ?
imports = [
./proton-auth.nix
./proton-calendar.nix
./proton-vpn.nix
];
}
+26
View File
@@ -0,0 +1,26 @@
{
config,
lib,
pkgs,
pkgs-unstable,
...
}: {
home.packages = [
pkgs-unstable.andcli # 2FA TUI for your shell
];
home.persistence."/persist" = lib.mkIf (config.var.impermanenceEnabled or false) {
directories = [".config/andcli"];
};
programs.zsh.shellAliases."andcli" = "${pkgs-unstable.andcli}/bin/andcli ~/.cache/protonauth.json.txt --type protonauth";
xdg.desktopEntries.andcli = {
name = "andcli";
exec = "${pkgs.ghostty}/bin/ghostty +new-window -e ${pkgs-unstable.andcli}/bin/andcli ${config.home.homeDirectory}/.cache/protonauth.json.txt --type protonauth";
comment = "2FA TUI for your shell";
categories = ["Utility" "Security" "ConsoleOnly"];
terminal = false;
settings.Keywords = "2fa;otp;totp;authenticator;security";
};
}
+7
View File
@@ -0,0 +1,7 @@
{pkgs, ...}: {
# TODO: config + desktop file
home.packages = [
pkgs.nur.repos.anotherhadi.proton-vpn-tui
pkgs.proton-vpn-cli
];
}
+11
View File
@@ -0,0 +1,11 @@
# Import all shell configurations
{
imports = [
./fzf.nix
./zsh.nix
./starship.nix
./zoxide.nix
./eza.nix
./direnv.nix
];
}
+8
View File
@@ -0,0 +1,8 @@
{
programs.direnv = {
enable = true;
nix-direnv = {
enable = true;
};
};
}
+16
View File
@@ -0,0 +1,16 @@
# Eza is a ls replacement
{
programs.zsh.initContent = ''
compdef eza=ls
'';
programs.eza = {
enable = true;
icons = "auto";
extraOptions = [
"--group-directories-first"
"--no-quotes"
"--icons=always"
];
};
}
+55
View File
@@ -0,0 +1,55 @@
# Fzf is a general-purpose command-line fuzzy finder.
{
config,
lib,
...
}: let
accent = "#" + config.lib.stylix.colors.base0D;
foreground = "#" + config.lib.stylix.colors.base05;
muted = "#" + config.lib.stylix.colors.base03;
previewCmd = "bat --color=always --style=plain,numbers --line-range=:500 {}";
in {
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "fd --type f --hidden --strip-cwd-prefix";
fileWidgetCommand = "fd --type f --hidden --strip-cwd-prefix";
fileWidgetOptions = ["--preview '${previewCmd}'"];
colors = lib.mkForce {
"fg+" = accent;
"bg+" = "-1";
"fg" = foreground;
"bg" = "-1";
"prompt" = muted;
"pointer" = accent;
"border" = muted;
"preview-border" = muted;
"scrollbar" = muted;
"preview-scrollbar" = muted;
"gutter" = muted;
};
defaultOptions = [
"--height=60%"
"--layout=reverse"
"--border=none"
"--prompt='/ '"
"--preview-window=right:65%:wrap:border-left"
"-i"
"--no-bold"
];
};
programs.zsh.initContent = lib.mkAfter ''
_fzf_file_no_hidden() {
local cmd result
cmd="''${FZF_DEFAULT_COMMAND/--hidden /}"
result=$(eval "''${cmd:-find . -type f}" | fzf --preview "${previewCmd}") \
&& LBUFFER+="$result"
zle reset-prompt
}
zle -N _fzf_file_no_hidden
'';
}
+60
View File
@@ -0,0 +1,60 @@
# starship is a minimal, fast, and extremely customizable prompt for any shell!
{
config,
lib,
...
}: let
accent = "#${config.lib.stylix.colors.base0D}";
background-alt = "#${config.lib.stylix.colors.base01}";
in {
programs.starship = {
enable = true;
settings = {
add_newline = true;
format = lib.concatStrings [
"$nix_shell"
"$hostname"
"$directory"
"$git_branch"
"$git_state"
"$git_status"
"$character"
];
directory = {
style = accent;
};
character = {
success_symbol = "[❯](${accent})";
error_symbol = "[❯](red)";
vimcmd_symbol = "[❮](cyan)";
};
nix_shell = {
format = "[$symbol]($style) ";
symbol = "🐚";
style = "";
};
git_branch = {
symbol = "[](${background-alt}) ";
style = "fg:${accent} bg:${background-alt}";
format = "on [$symbol$branch]($style)[](${background-alt}) ";
};
git_status = {
format = "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218)($ahead_behind$stashed)]($style)";
style = "cyan";
conflicted = "";
renamed = "";
deleted = "";
stashed = "≡";
};
git_state = {
format = "([$state( $progress_current/$progress_total)]($style)) ";
style = "bright-black";
};
};
};
}
+7
View File
@@ -0,0 +1,7 @@
# Zoxide is a cd replacement
{
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
}
+179
View File
@@ -0,0 +1,179 @@
# My shell configuration
{
pkgs,
lib,
config,
...
}: {
home.packages = with pkgs; [
bat
ripgrep
];
home = {
sessionVariables = {
COLORTERM = "truecolor";
MANPAGER = "bat -l man -p";
};
};
programs.zsh = {
enable = true;
autocd = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
historySubstringSearch.enable = true;
plugins = [
{
name = "zsh-vi-mode";
src = pkgs.zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}
];
history = {
path = lib.mkIf (config.var.impermanenceEnabled or false) "/persist${config.home.homeDirectory}/.zsh_history";
ignoreDups = true;
findNoDups = true;
expireDuplicatesFirst = true;
ignoreSpace = true;
append = true;
save = 10000;
size = 10000;
};
setOptions = [
"NOBEEP"
"AUTOCD"
"NUMERIC_GLOB_SORT"
];
profileExtra = lib.optionalString (config.home.sessionPath != []) ''
export PATH="$PATH''${PATH:+:}${lib.concatStringsSep ":" config.home.sessionPath}"
'';
shellAliases = {
# Change default
vim = "nvim";
vi = "nvim";
cd = "z";
ls = "eza --icons=always --no-quotes";
tree = "eza --icons=always --tree --no-quotes";
mkdir = "mkdir -p";
nix-shell = "nix-shell --command zsh";
grep = "rg --color=auto";
diff = "diff --color=auto";
df = "df -h";
# Shortcuts
spt = "myx";
open = "${pkgs.xdg-utils}/bin/xdg-open";
notes = "nvim ~/Notes/index.md --cmd 'cd ~/notes' -c ':lua Snacks.picker.smart()'";
# git
g = "lazygit";
ga = "git add";
gc = "git commit";
gp = "git push";
gpl = "git pull";
gs = "git status";
gd = "git diff";
gco = "git checkout";
gcb = "git checkout -b";
gbr = "git branch";
grs = "git reset HEAD~1";
grh = "git reset --hard HEAD~1";
gaa = "git add .";
gcm = "git commit -m";
# Original binaries
ocat = "/run/current-system/sw/bin/cat";
ols = "/run/current-system/sw/bin/ls";
ocd = "builtin cd";
# Typo
clera = "clear";
celar = "clear";
claer = "clear";
sl = "ls";
};
initContent = lib.mkMerge [
(lib.mkOrder 550 ''
function zvm_config() {
ZVM_INSERT_MODE_CURSOR=$ZVM_CURSOR_BEAM
ZVM_NORMAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK
ZVM_VISUAL_MODE_CURSOR=$ZVM_CURSOR_BLOCK
ZVM_VI_HIGHLIGHT_BACKGROUND=none
ZVM_VI_HIGHLIGHT_FOREGROUND=none
ZVM_VI_HIGHLIGHT_EXTRASTYLE=none
}
'')
# bash
''
# cat: preview images inline (kitty graphics protocol, works in Ghostty)
# instead of dumping bat's binary garbage; falls back to bat otherwise.
cat() {
local -a imgs rest
local f
for f in "$@"; do
case "''${f:l}" in
*.png|*.jpg|*.jpeg|*.gif|*.bmp|*.webp|*.tiff|*.ico)
imgs+=("$f")
;;
*)
rest+=("$f")
;;
esac
done
if (( ''${#imgs} )); then
for f in "''${imgs[@]}"; do
chafa --format=kitty "$f"
done
fi
if (( ''${#rest} || ! ''${#imgs} )); then
bat --theme=base16 --color=always --paging=never --tabs=2 --wrap=never --plain "''${rest[@]}"
fi
}
# Suffix Aliases
alias -s {nix,md,txt,yml,yaml,go}=nvim
alias -s {json,jsonl}=jless
alias -s {csv,tsv,parquet,pqt,arrow,db,sqlite,xls,xlsx,xlsm,xlsb,fwf}=tw
alias -s {png,jpg,jpeg,gif,pdf}=xdg-open
# Global Aliases
alias -g G="| rg"
alias -g L="| less"
alias -g V="| nvim"
alias -g H="| head"
alias -g T="| tail"
alias -g JQ="| jq"
alias -g C="| wl-copy"
alias -g NE="2>/dev/null"
alias -g ND=">/dev/null"
alias -g NUL=">/dev/null 2>&1"
autoload zmv # Mv for multiple files
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zvm_after_init() {
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
bindkey '^F' _fzf_file_no_hidden
bindkey '^R' fzf-history-widget
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
}
''
];
};
}
+25
View File
@@ -0,0 +1,25 @@
# Myx is a lean terminal Spotify player written in Rust, with album-art-reactive
# theming, a live visualizer and synced lyrics.
{
config,
pkgs-unstable,
pkgs,
lib,
...
}: {
home.packages = [pkgs-unstable.myx];
home.persistence."/persist" = lib.mkIf (config.var.impermanenceEnabled or false) {
directories = [".config/myx"];
};
xdg.desktopEntries.myx = {
name = "Spotify";
exec = "${pkgs.ghostty}/bin/ghostty --window-padding-x=0 --window-padding-y=0 -e ${pkgs-unstable.myx}/bin/myx";
icon = "spotify";
comment = "Control Spotify from the terminal";
categories = ["Audio" "Music"];
terminal = false;
settings.Keywords = "spotify;myx;music;";
};
}
+26
View File
@@ -0,0 +1,26 @@
# TLDR provides simplified, example-based help pages for shell commands
{
pkgs,
inputs,
...
}: let
tealdeerCache = pkgs.runCommand "tealdeer-tldr-cache" {} ''
mkdir -p $out/tldr-pages
for d in ${inputs.tldr-pages-src}/pages ${inputs.tldr-pages-src}/pages.*; do
[ -d "$d" ] || continue
cp -r "$d" "$out/tldr-pages/$(basename "$d")"
done
if [ -d "$out/tldr-pages/pages" ] && [ ! -d "$out/tldr-pages/pages.en" ]; then
mv "$out/tldr-pages/pages" "$out/tldr-pages/pages.en"
fi
'';
in {
programs = {
tealdeer = {
enable = true; # Fast tldr client
enableAutoUpdates = false;
settings.directories.cache_dir = "${tealdeerCache}";
};
zsh.shellAliases."tldr" = "tldr --quiet";
};
}