From 80e55fc455bc7c6846a71aa487c4467995106242 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 29 May 2026 01:29:25 +0200 Subject: scripts/why-depends: Support limiting the search to precises names --- scripts/why-depends | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'scripts/why-depends') diff --git a/scripts/why-depends b/scripts/why-depends index 61f40c5d..ae1ac6f7 100755 --- a/scripts/why-depends +++ b/scripts/why-depends @@ -11,12 +11,13 @@ main() { base=".#nixosConfigurations.$host.config.system.build.toplevel" fi - fd "[a-zA-Z0-9]{32}-$package-" /nix/store --type directory --threads 1 --exec nix why-depends "$base" + fd "[a-zA-Z0-9]{32}-$package" /nix/store --type directory --threads 1 --exec nix --option warn-dirty false why-depends "$base" } running=false host="$(hostname)" packages="" +direct_packages="" while [ "$#" -ne 0 ]; do case "$1" in @@ -27,6 +28,10 @@ while [ "$#" -ne 0 ]; do shift 1 host="$1" ;; + "--direct") + shift 1 + direct_packages="$direct_packages $1" + ;; *) # Treat everything else as a package to check packages="$packages $1" @@ -36,8 +41,16 @@ while [ "$#" -ne 0 ]; do shift 1 done -for package in $packages; do - main "$running" "$host" "$package" -done +if [ -n "$packages" ]; then + for package in $packages; do + main "$running" "$host" "$package-" + done +fi + +if [ -n "$direct_packages" ]; then + for package in $direct_packages; do + main "$running" "$host" "$package-[0-9]" + done +fi # vim: ft=sh -- cgit v1.3.1