about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-03 01:09:05 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-03 01:09:05 +0100
commitb98f0f6df000e87233b502cb5768cb11ebae27ef (patch)
tree5b750087b1200676c6f80c2e2a353a8f7411ce2d
parentpkgs/notify-run: Actually provide `notify-send` to the binary (diff)
downloadnixos-config-b98f0f6df000e87233b502cb5768cb11ebae27ef.zip
scripts/why-depends: Simply and support comparison base selection
-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