about summary refs log tree commit diff stats
path: root/scripts/why-depends
blob: 1afe915050dbc466e2b4fbe3f1a24886ab5e80a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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