This commit is contained in:
Peder Bergebakken Sundt 2025-02-27 13:58:35 +01:00
parent 511b19b9a8
commit b9b4b3b59a

@ -1,8 +1,13 @@
function ns() {
local args=()
for pkg in "$@"; do
args+=(nixpkgs#"$pkg")
if [[ "$pkg" =~ ^.*[#:/].*$ ]]; then
args+=("$pkg")
else
args+=(nixpkgs#"$pkg")
fi
done
>&2 echo + exec nix shell "${args[@]}"
local outpaths="$(
export NIXPKGS_ALLOW_BROKEN
@ -21,11 +26,13 @@ function ns() {
readarray -d $'\n' -t storepaths_build <<<"$outpaths"
# traverse propagated inputs
# TODO: rethink this logic
local -i idx=-1
while [[ $((++idx)) -lt "${#storepaths_native[@]}" ]]; do
if [[ -f "${storepaths_native[$idx]}"/nix-support/propagated-native-build-inputs ]]; then
storepaths_native+=($(cat "${storepaths_native[$idx]}"/nix-support/propagated-native-build-inputs))
fi
# TODO: needed?
if [[ -f "${storepaths_native[$idx]}"/nix-support/propagated-build-inputs ]]; then
storepaths_build+=($(cat "${storepaths_native[$idx]}"/nix-support/propagated-build-inputs))
fi