summaryrefslogtreecommitdiff
path: root/nix/modules/home/user.nix
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2025-09-12 19:32:06 -0700
committerPreston Pan <ret2pop@gmail.com>2025-09-12 19:32:06 -0700
commitcae70df061d9fc4f33a2da66a21c86eb3eb1fa3b (patch)
treebaa5edf5af062f3a28647f318165d196b0b7093d /nix/modules/home/user.nix
parentc15492d8aa38b7125dc6574c08f6a765aad44fcb (diff)
update before new lock file, working on VPS
Diffstat (limited to 'nix/modules/home/user.nix')
-rw-r--r--nix/modules/home/user.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/nix/modules/home/user.nix b/nix/modules/home/user.nix
index d0cad9a..24b61da 100644
--- a/nix/modules/home/user.nix
+++ b/nix/modules/home/user.nix
@@ -29,6 +29,7 @@
mupdf
zathura
+ fzf
# passwords
age sops
@@ -64,6 +65,44 @@
pfetch
libnotify
htop
+
+ (pkgs.writeShellScriptBin "help"
+ ''
+#!/usr/bin/env sh
+# Portable, colored, nicely aligned alias list
+
+# Generate uncolored alias pairs
+aliases=$(cat <<'EOF'
+${let aliases = config.programs.zsh.shellAliases;
+ in lib.concatStringsSep "\n" (lib.mapAttrsToList (name: value:
+ "${name} -> ${value}"
+ ) aliases)}
+EOF
+ )
+
+# Align and color using awk
+echo "$aliases" | awk '
+BEGIN {
+ GREEN="\033[0;32m";
+ YELLOW="\033[0;33m";
+ RESET="\033[0m";
+ maxlen=0;
+ }
+{
+ # Split line on " -> "
+ split($0, parts, / -> /);
+ name[NR]=parts[1];
+ cmd[NR]=parts[2];
+ if(length(parts[1])>maxlen) maxlen=length(parts[1]);
+}
+END {
+ for(i=1;i<=NR;i++) {
+ # printf with fixed width for alias name
+ printf "%s%-*s%s -> %s%s%s\n", GREEN, maxlen, name[i], RESET, YELLOW, cmd[i], RESET;
+ }
+}'
+'')
+
(writeShellScriptBin "remote-build"
''
#!/bin/bash