Skip to content

Commit 823ba3e

Browse files
authored
[shellenv] prepend to XDG_DATA_DIRS, instead of overwriting (#1041)
## Summary This PR ensures we preserve the XDG_DATA_DIRS env-var by appending the original value to the end of the new shellenv XDG_DATA_DIRS paths: `XDG_DATA_DIR={shellenv-XDG_DATA_DIR}:{original-XDG_DATA_DIR}` ## How was it tested? I have direnv enabled in my devbox repo ``` > cd ~/code/jetpack > echo $XDG_DATA_DIRS some /nix/store/.... path is printed > cd devbox # direnv kicks in > echo $XDG_DATA_DIRS the original XDG_DATA_DIRS is preserved BEFORE: this would be empty ```
1 parent 9e6eed0 commit 823ba3e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/impl/devbox.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,12 @@ func (d *Devbox) computeNixEnv(ctx context.Context, usePrintDevEnvCache bool) (m
812812

813813
d.setCommonHelperEnvVars(env)
814814

815+
// preserve the original XDG_DATA_DIRS by prepending to it
816+
env["XDG_DATA_DIRS"] = JoinPathLists(
817+
env["XDG_DATA_DIRS"],
818+
os.Getenv("XDG_DATA_DIRS"),
819+
)
820+
815821
return env, addHashToEnv(env)
816822
}
817823

0 commit comments

Comments
 (0)