about summary refs log tree commit diff stats
path: root/scripts/why-depends
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/why-depends')
-rwxr-xr-xscripts/why-depends13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/why-depends b/scripts/why-depends
index 59f8d25b..01471ce2 100755
--- a/scripts/why-depends
+++ b/scripts/why-depends
@@ -4,11 +4,14 @@ package="$1"
 version="$2"
 shift 2
 
-host="$(hostname)"
-
-fd "$package-$version" /nix/store --type directory | while read -r dir; do
-    nix why-depends "$@" ".#nixosConfigurations.$host.config.system.build.toplevel" "$dir"
-done
+if [ "$1" = "--running" ]; then
+    shift 1
+    base="/run/current-system"
+else
+    host="$(hostname)"
+    base=".#nixosConfigurations.$host.config.system.build.toplevel"
+fi
 
+fd "$package-$version$" /nix/store --type directory --threads 1 --exec nix why-depends "$@" "$base"
 
 # vim: ft=sh