{ lib, writeShellApplication, fzf, nix, util-linux, packageList, flakeUrl, }: let packageListFile = builtins.toFile "millerson-overlay-packages.tsv" packageList; in writeShellApplication { name = "millerson-overlay-launcher"; runtimeInputs = [ fzf nix util-linux # column ]; text = '' # Format for fzf: "name description" (tab-aligned) entries=$(column -t -s $'\t' < "${packageListFile}") if [[ -z $entries ]]; then echo "No packages found" >&2 exit 1 fi # Let user pick with fzf selected=$(echo "$entries" | fzf \ --header="Select an pkg to run (ESC to cancel)" \ --preview-window=hidden \ --no-multi \ --height=~40% \ --layout=reverse) || exit 0 # Extract package name (first word) pkg_name=$(echo "$selected" | awk '{print $1}') if [[ -z $pkg_name ]]; then exit 0 fi echo "→ Running: nix run ${flakeUrl}#$pkg_name" exec nix run "${flakeUrl}#$pkg_name" ''; meta = { description = "Interactive fzf launcher for millerson-overlay.nix packages"; license = lib.licenses.mit; mainProgram = "millerson-overlay-launcher"; platforms = lib.platforms.all; }; passthru = { hideFromDocs = true; }; }