weechat-xmpp/.envrc
2021-06-30 07:26:06 +01:00

49 lines
1.2 KiB
Bash

# -*- mode: sh; -*-
# Thanks <https://github.com/direnv/direnv/issues/73#issuecomment-152284914>
export_function()
{
local name=$1
local alias_dir=$PWD/.direnv/aliases
mkdir -p "$alias_dir"
PATH_add "$alias_dir"
local target="$alias_dir/$name"
if declare -f "$name" >/dev/null; then
echo "#!$SHELL" > "$target"
declare -f "$name" >> "$target" 2>/dev/null
# Notice that we add shell variables to the function trigger.
echo "$name \$*" >> "$target"
chmod +x "$target"
fi
}
use_guix()
{
# Recreate a garbage collector root.
gcroots="$HOME/.config/guix/gcroots"
mkdir -p "$gcroots"
gcroot="$gcroots/guix"
if [ -L "$gcroot" ]
then
rm -v "$gcroot"
fi
# Miscellaneous packages.
ENVIRONMENTS=(
weechat
)
# Environment packages.
PACKAGES=(
autoconf autoconf-archive automake libtool
make cmake gcc-toolchain pkg-config patchelf
weechat xz libxml2 libstrophe json-c
)
# Thanks <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg00859.html>
eval "$(guix environment --search-paths --root="$gcroot" ${ENVIRONMENTS[@]} --ad-hoc ${PACKAGES[@]} "$@")"
export CC=gcc
}
use guix --with-debug-info=weechat --with-debug-info=libstrophe