about summary refs log tree commit diff stats
path: root/scripts/why-depends
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/why-depends23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/why-depends b/scripts/why-depends
new file mode 100755
index 00000000..1afe9150
--- /dev/null
+++ b/scripts/why-depends
@@ -0,0 +1,23 @@
+#! /usr/bin/env sh
+
+search_string="$1-"
+shift 1
+
+if [ "$1" != "" ]; then
+    # Add the version
+    search_string="${search_string}${1}$"
+    shift 1
+fi
+
+if [ "$1" = "--running" ]; then
+    shift 1
+    base="/run/current-system"
+else
+    host="$(hostname)"
+    base=".#nixosConfigurations.$host.config.system.build.toplevel"
+fi
+
+
+fd "$search_string" /nix/store --type directory --threads 1 --exec nix why-depends "$@" "$base"
+
+# vim: ft=sh