2021-06-25 22:39:20 +00:00
|
|
|
# -*- 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()
|
|
|
|
{
|
|
|
|
# Set GitHub token.
|
|
|
|
export GUIX_GITHUB_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
|
|
|
|
|
|
# Unset 'GUIX_PACKAGE_PATH'.
|
|
|
|
export GUIX_PACKAGE_PATH=""
|
|
|
|
|
|
|
|
# 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.
|
|
|
|
PACKAGES_MAINTENANCE=(
|
|
|
|
direnv
|
|
|
|
git
|
|
|
|
git:send-email
|
|
|
|
gnupg
|
|
|
|
guile-colorized
|
|
|
|
guile-readline
|
|
|
|
less
|
|
|
|
ncurses
|
|
|
|
openssh
|
|
|
|
xdot
|
|
|
|
)
|
|
|
|
|
|
|
|
# Environment packages.
|
|
|
|
PACKAGES=(help2man guile-sqlite3 guile-gcrypt
|
|
|
|
autoconf autoconf-archive automake libtool
|
2021-06-26 00:08:12 +00:00
|
|
|
make cmake gcc-toolchain pkg-config
|
2021-06-26 00:30:39 +00:00
|
|
|
libressl libxml2 libstrophe json-c weechat)
|
2021-06-25 22:39:20 +00:00
|
|
|
|
|
|
|
# Thanks <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg00859.html>
|
2021-06-26 00:08:12 +00:00
|
|
|
eval "$(guix environment --search-paths --root="$gcroot" --ad-hoc ${PACKAGES[@]} ${PACKAGES_MAINTENANCE[@]} "$@")"
|
2021-06-25 22:39:20 +00:00
|
|
|
|
|
|
|
export CC=gcc
|
|
|
|
}
|
|
|
|
|
|
|
|
use guix
|