ns
This commit is contained in:
@ -25,7 +25,7 @@ _ns() {
|
|||||||
cmd=("${cmd[@]:1}")
|
cmd=("${cmd[@]:1}")
|
||||||
if [[ ${#cmd[@]} -gt 0 ]]; then
|
if [[ ${#cmd[@]} -gt 0 ]]; then
|
||||||
(
|
(
|
||||||
_ns false "${args[@]}"
|
_ns "$is_dev" "${args[@]}"
|
||||||
set -x
|
set -x
|
||||||
"${cmd[@]}"
|
"${cmd[@]}"
|
||||||
)
|
)
|
||||||
@ -53,7 +53,7 @@ _ns() {
|
|||||||
|
|
||||||
# traverse propagated inputs
|
# traverse propagated inputs
|
||||||
# this is safe since the store paths form a DAG
|
# this is safe since the store paths form a DAG
|
||||||
# TODO: rethink this logic
|
# TODO: rethink native logic
|
||||||
local -i idx=-1
|
local -i idx=-1
|
||||||
while [[ $((++idx)) -lt "${#storepaths_native[@]}" ]]; do
|
while [[ $((++idx)) -lt "${#storepaths_native[@]}" ]]; do
|
||||||
if [[ -f "${storepaths_native[$idx]}"/nix-support/propagated-native-build-inputs ]]; then
|
if [[ -f "${storepaths_native[$idx]}"/nix-support/propagated-native-build-inputs ]]; then
|
||||||
@ -72,16 +72,11 @@ _ns() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# find things to add to env
|
# find things to add to env
|
||||||
local -a add_to_path=()
|
|
||||||
local -a add_to_libs=()
|
|
||||||
local -a add_to_share=()
|
|
||||||
local -a add_to_include=()
|
|
||||||
local -a add_to_pythonpath=()
|
|
||||||
|
|
||||||
local -A seen=()
|
local -A seen=()
|
||||||
# for storepath in "${storepaths_native[@]}"; do
|
# for storepath in "${storepaths_native[@]}"; do
|
||||||
for storepath in "${storepaths_build[@]}"; do
|
for storepath in "${storepaths_build[@]}"; do
|
||||||
if [[ -n "${seen["$storepath"]:-}" ]]; then
|
if [[ -v seen["$storepath"] ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
seen["$storepath"]=1
|
seen["$storepath"]=1
|
||||||
@ -90,10 +85,15 @@ _ns() {
|
|||||||
export PATH="$storepath/bin${PATH:+":$PATH"}"
|
export PATH="$storepath/bin${PATH:+":$PATH"}"
|
||||||
fi
|
fi
|
||||||
if >/dev/null compgen -G "$storepath/lib/*.so"; then
|
if >/dev/null compgen -G "$storepath/lib/*.so"; then
|
||||||
export LD_LIBRARY_PATH="$(IFS=: ; printf "%s" "$storepath"/lib/*.so)${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}"
|
for path in "$storepath"/lib/*.so; do
|
||||||
|
export LD_LIBRARY_PATH="${path}${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
if >/dev/null compgen -G "$storepath/lib/*.so.*"; then
|
if >/dev/null compgen -G "$storepath/lib/*.so.*"; then
|
||||||
export LD_LIBRARY_PATH="$(IFS=: ; printf "%s" "$storepath"/lib/*.so.*)${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}"
|
local path
|
||||||
|
for path in "$storepath"/lib/*.so.*; do
|
||||||
|
export LD_LIBRARY_PATH="${path}${LD_LIBRARY_PATH:+":$LD_LIBRARY_PATH"}"
|
||||||
|
done
|
||||||
export CMAKE_LIBRARY_PATH="$storepath/lib${CMAKE_LIBRARY_PATH:+":$CMAKE_LIBRARY_PATH"}"
|
export CMAKE_LIBRARY_PATH="$storepath/lib${CMAKE_LIBRARY_PATH:+":$CMAKE_LIBRARY_PATH"}"
|
||||||
fi
|
fi
|
||||||
if [[ -d "$storepath/lib/pkgconfig" ]]; then
|
if [[ -d "$storepath/lib/pkgconfig" ]]; then
|
||||||
@ -102,6 +102,9 @@ _ns() {
|
|||||||
if [[ -d "$storepath/share" ]]; then
|
if [[ -d "$storepath/share" ]]; then
|
||||||
export XDG_DATA_DIRS="$storepath/share${XDG_DATA_DIRS:+":$XDG_DATA_DIRS"}"
|
export XDG_DATA_DIRS="$storepath/share${XDG_DATA_DIRS:+":$XDG_DATA_DIRS"}"
|
||||||
fi
|
fi
|
||||||
|
if [[ -d "$storepath/share/man" ]]; then
|
||||||
|
export MANPATH="$storepath/share/man${MANPATH:+":$MANPATH"}"
|
||||||
|
fi
|
||||||
if [[ -d "$storepath/share/pkgconfig" ]]; then
|
if [[ -d "$storepath/share/pkgconfig" ]]; then
|
||||||
export PKG_CONFIG_PATH="$storepath/share/pkgconfig${PKG_CONFIG_PATH:+":$PKG_CONFIG_PATH"}"
|
export PKG_CONFIG_PATH="$storepath/share/pkgconfig${PKG_CONFIG_PATH:+":$PKG_CONFIG_PATH"}"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user