about summary refs log tree commit diff stats
path: root/scripts/why-depends
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-11 13:36:11 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-12-11 13:36:11 +0100
commite81ff077041a04fb070c4bced18a89585f39ddcc (patch)
treee2feae25859f0a80ca798978d6cd48d06c06f8e9 /scripts/why-depends
parentmodules/disk: Adapt to lix's new build directory (diff)
downloadnixos-config-e81ff077041a04fb070c4bced18a89585f39ddcc.zip
scripts/why-depends: Also work without a version argument
Diffstat (limited to '')
-rwxr-xr-xscripts/why-depends14
1 files changed, 10 insertions, 4 deletions
diff --git a/scripts/why-depends b/scripts/why-depends
index 01471ce2..1afe9150 100755
--- a/scripts/why-depends
+++ b/scripts/why-depends
@@ -1,8 +1,13 @@
 #! /usr/bin/env sh
 
-package="$1"
-version="$2"
-shift 2
+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
@@ -12,6 +17,7 @@ else
     base=".#nixosConfigurations.$host.config.system.build.toplevel"
 fi
 
-fd "$package-$version$" /nix/store --type directory --threads 1 --exec nix why-depends "$@" "$base"
+
+fd "$search_string" /nix/store --type directory --threads 1 --exec nix why-depends "$@" "$base"
 
 # vim: ft=sh