Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add direnv allow persistence between sessions #762

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rootfs/etc/direnv/bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ unset BASH_ENV
export DIRENV_LOG_FORMAT=

# Allow current working directory (if we have permission)
if [ -f .envrc ] && [ -w /etc/direnv/allow ]; then
if [ -f .envrc ] && [ -d /usr/share/xdg_data_home/direnv ] && [ -w /usr/share/xdg_data_home/direnv ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if [ -f .envrc ] && [ -d /usr/share/xdg_data_home/direnv ] && [ -w /usr/share/xdg_data_home/direnv ]; then
if [ -f .envrc ] && [ -d "${XDG_DATA_HOME}/direnv" ] && [ -w "${XDG_DATA_HOME}/direnv" ]; then

ENV XDG_DATA_HOME=/usr/share/xdg_data_home

direnv allow .
fi

Expand Down
5 changes: 5 additions & 0 deletions rootfs/templates/wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ function use() {
if [ -f "${geodesic_default_env_file}" ]; then
DOCKER_ARGS+=(--env-file=${geodesic_default_env_file})
fi
# persist direnv between sessions by putting in $HOME/.geodesic/direnv folder
local geodesic_folder="$(dirname "$geodesic_default_env_file")"
local geodesic_direnv_folder=${geodesic_folder}/direnv
mkdir -p $geodesic_direnv_folder
DOCKER_ARGS+=(--volume="$geodesic_direnv_folder:/usr/share/xdg_data_home/direnv")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENV XDG_DATA_HOME=/usr/share/xdg_data_home

Suggested change
DOCKER_ARGS+=(--volume="$geodesic_direnv_folder:/usr/share/xdg_data_home/direnv")
DOCKER_ARGS+=(--volume="$geodesic_direnv_folder:$XDG_DATA_HOME/direnv")

else
echo "# Disabling user customizations: GEODESIC_CUSTOMIZATION_DISABLED is set and not 'false'"
DOCKER_ARGS+=(--env GEODESIC_CUSTOMIZATION_DISABLED)
Expand Down