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-depends17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/why-depends b/scripts/why-depends
new file mode 100755
index 00000000..01471ce2
--- /dev/null
+++ b/scripts/why-depends
@@ -0,0 +1,17 @@
+#! /usr/bin/env sh
+
+package="$1"
+version="$2"
+shift 2
+
+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